|
|
|
@ -8,10 +8,12 @@ import vspt_freecad
|
|
|
|
|
import FreeCAD as App |
|
|
|
|
import Import |
|
|
|
|
import ImportGui |
|
|
|
|
import TechDrawGui |
|
|
|
|
|
|
|
|
|
project_folder = os.getcwd() |
|
|
|
|
output_folder = project_folder + '/dist/STEP' |
|
|
|
|
assemblies_output_folder = project_folder + '/dist/FCStd' |
|
|
|
|
drawings_output_folder = project_folder + '/dist/PDF' |
|
|
|
|
|
|
|
|
|
def convert_file(file_name, output_format): |
|
|
|
|
doc = App.open(project_folder + '/' + file_name) |
|
|
|
@ -70,6 +72,17 @@ def convert_file(file_name, output_format):
|
|
|
|
|
else: |
|
|
|
|
Import.export([main_object], output_path) |
|
|
|
|
|
|
|
|
|
# Export 2D drawing |
|
|
|
|
page_name = doc.Name + '_Drawing' |
|
|
|
|
drawing_page = doc.getObject(page_name) |
|
|
|
|
if drawing_page is not None: |
|
|
|
|
drawing_output_path = drawings_output_folder + '/' + os.path.dirname(file_name) + '/' + Path(file_name).stem + '.pdf' |
|
|
|
|
drawing_output_dir = os.path.dirname(drawing_output_path) |
|
|
|
|
if not os.path.exists(drawing_output_dir): |
|
|
|
|
os.makedirs(drawing_output_dir) |
|
|
|
|
drawing_page.ViewObject.Visibility = True |
|
|
|
|
TechDrawGui.export([drawing_page], drawing_output_path) |
|
|
|
|
|
|
|
|
|
vspt_freecad.close_all_docs() |
|
|
|
|
|
|
|
|
|
def export_assembly(doc, file_name, output_format): |
|
|
|
|