I have a couple of issues with an export script I wrote.
The biggest issue for other draftsmen/-women here could be, that someone makes a lot of changes, doesnt save the project, starts the export script and loses the progress made.
Because we work in an ACC Cloud Project Im very hesitant to try to make any changes to the model or save process, as not to damage it.
The current solution is that the Dynamo File name for now is “SAVE-FIRST_Export…”, as the user can do it with one click and not much time beeing lost.
The script itself works pretty good on the first run. It gets the Export Setups, exports IFC and Revit Files, removes various things from the Revit File to prepare it for the Export, leaving the User to only purge the unused items a couple of times.
It even logs all its progress and displays it to the user.
The export time went from 20 min or more down to 3-4 minutes.
The issues start to come up when one tries to start it a second time. Even reopening the cloud project and starting the export script, it fails to get the correct Export Setup (“None”, hangs up at .Update).
Edit: Now It fails to delete Objects. It’s not really getting better.
Also, if old export files exist, the overwriting code doesn’t seem to work or it causes errors:
if not os.path.exists(folder_ifc_path):
os.makedirs(folder_ifc_path)
if os.path.exists(folder_ifc_path+out_ifc_name_ifc):
os.remove(folder_ifc_path+out_ifc_name_ifc)
time.sleep(100)
# later in the code
try:
result = doc.Export(folder_ifc_path, out_ifc_name_ifc, options)
except Exception as e:
ctypes.windll.user32.MessageBoxW(0, "Error with IFC Export:" + "\n" + str(e), "Export failed", 0)
Any help, tricks or tipps how to make this better are appreciated.
Thank you, dear Dynamo community
SAVE-FIRST_PROJECT-EXPORT.dyn (46.0 KB)