Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions Project-Archiver/commands/ExportCommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def export_folder(root_folder, output_folder, file_types, write_version, name_op
try:
output_name = get_name(write_version, name_option)
export_active_doc(output_folder, file_types, output_name)

# TODO add handling
except ValueError as e:
ao.ui.messageBox(str(e))
Expand All @@ -67,7 +67,7 @@ def export_active_doc(folder, file_types, output_name):

ao = AppObjects()
export_mgr = ao.export_manager

export_functions = [export_mgr.createIGESExportOptions,
export_mgr.createSTEPExportOptions,
export_mgr.createSATExportOptions,
Expand All @@ -76,6 +76,8 @@ def export_active_doc(folder, file_types, output_name):
export_mgr.createSTLExportOptions]
export_extensions = ['.igs', '.step', '.sat', '.smt', '.f3d', '.stl']



for i in range(file_types.count-2):

if file_types.item(i).isSelected:
Expand All @@ -96,10 +98,19 @@ def export_active_doc(folder, file_types, output_name):
export_mgr.execute(export_options)

if file_types.item(file_types.count - 1).isSelected:
stl_export_name = folder + output_name + '.stl'
stl_options = export_mgr.createSTLExportOptions(ao.design.rootComponent, stl_export_name)
export_mgr.execute(stl_options)

# Check if document contains any solid bodies
design = adsk.fusion.Design.cast(ao.product)
if design is not None:
root_comp = design.rootComponent
if root_comp.bRepBodies.count == 0:
# Skip this document if it contains no solid bodies
SKIPPED_FILES.append(ao.document.name)
else:
stl_export_name = folder + output_name + '.stl'
stl_options = export_mgr.createSTLExportOptions(ao.design.rootComponent, stl_export_name)
export_mgr.execute(stl_options)

ao.document.close(False) # Close the document after exporting

def dup_check(name):
if os.path.exists(name):
Expand Down