|
|
@ -72,11 +72,7 @@ def convert_file(file_name, output_format): |
|
|
|
|
|
|
|
|
|
|
|
close_all_docs() |
|
|
|
close_all_docs() |
|
|
|
|
|
|
|
|
|
|
|
def convert_assembly(file_name, output_format): |
|
|
|
def export_assembly(doc, file_name, output_format): |
|
|
|
print("Exporting assembly " + file_name + "...") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
doc = App.open(project_folder + '/' + file_name) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
root_objects = [] |
|
|
|
root_objects = [] |
|
|
|
main_object = None |
|
|
|
main_object = None |
|
|
|
|
|
|
|
|
|
|
@ -115,17 +111,27 @@ def convert_assembly(file_name, output_format): |
|
|
|
else: |
|
|
|
else: |
|
|
|
ImportGui.export([main_object], output_path) |
|
|
|
ImportGui.export([main_object], output_path) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def convert_assembly(file_name, output_format): |
|
|
|
|
|
|
|
print("Exporting assembly " + file_name + "...") |
|
|
|
|
|
|
|
doc = App.open(project_folder + '/' + file_name) |
|
|
|
|
|
|
|
export_assembly(doc, file_name, output_format) |
|
|
|
close_all_docs() |
|
|
|
close_all_docs() |
|
|
|
|
|
|
|
|
|
|
|
def export_configuration(doc, config_name, output_filename): |
|
|
|
def export_configuration(file_name, config_name, output_filename, output_format): |
|
|
|
print('Generating assembly for configuration '+config_name+'...') |
|
|
|
print('Generating assembly for configuration '+config_name+'...') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
doc = App.open(project_folder + '/' + file_name) |
|
|
|
|
|
|
|
|
|
|
|
Gui.Selection.clearSelection() |
|
|
|
Gui.Selection.clearSelection() |
|
|
|
Gui.Selection.addSelection('vheliotech','Model','Configurations.'+doc.getObjectsByLabel(config_name)[0].Name+'.') |
|
|
|
Gui.Selection.addSelection('vheliotech','Model','Configurations.'+doc.getObjectsByLabel(config_name)[0].Name+'.') |
|
|
|
Gui.runCommand('Asm4_applyConfiguration') |
|
|
|
Gui.runCommand('Asm4_applyConfiguration') |
|
|
|
Gui.Selection.clearSelection() |
|
|
|
Gui.Selection.clearSelection() |
|
|
|
|
|
|
|
|
|
|
|
doc.saveAs(assemblies_output_folder + '/' + output_filename + '.FCStd') |
|
|
|
export_assembly(doc, output_filename, output_format) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#doc.saveAs(assemblies_output_folder + '/' + output_filename + '.FCStd') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
close_all_docs() |
|
|
|
|
|
|
|
|
|
|
|
try: |
|
|
|
try: |
|
|
|
folders = [ |
|
|
|
folders = [ |
|
|
@ -141,14 +147,12 @@ try: |
|
|
|
print(source_path) |
|
|
|
print(source_path) |
|
|
|
convert_file(source_path, 'step') |
|
|
|
convert_file(source_path, 'step') |
|
|
|
|
|
|
|
|
|
|
|
convert_assembly('vheliotech.FCStd', 'step') |
|
|
|
#convert_assembly('vheliotech.FCStd', 'step') |
|
|
|
|
|
|
|
|
|
|
|
'''doc = App.open(project_folder + '/vheliotech.FCStd') |
|
|
|
export_configuration('vheliotech.FCStd', 'Config_Integrale', 'vheliotech-integral', 'step') |
|
|
|
export_configuration(doc, 'Config_Integrale', 'vheliotech-config-integrale') |
|
|
|
export_configuration('vheliotech.FCStd', 'Config_Solaire', 'vheliotech-solaire', 'step') |
|
|
|
export_configuration(doc, 'Config_Solaire', 'vheliotech-config-solaire') |
|
|
|
export_configuration('vheliotech.FCStd', 'Config_Motorisee', 'vheliotech-motorise', 'step') |
|
|
|
export_configuration(doc, 'Config_Motorisee', 'vheliotech-config-motorisee') |
|
|
|
export_configuration('vheliotech.FCStd', 'Config_Basique', 'vheliotech-basique', 'step') |
|
|
|
export_configuration(doc, 'Config_Basique', 'vheliotech-config-basique') |
|
|
|
|
|
|
|
close_all_docs()''' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
except Exception as e: |
|
|
|
except Exception as e: |
|
|
|
print(e) |
|
|
|
print(e) |
|
|
|