Core: Import STEP: Cancel button does not cancel (#16499)
* Fix importing .step file when user cancelled import settings dialog * Refactor object loading python code, fix not using settings when STEP options dialog not shown * Use custom exception type for user cancelling import instead of `RuntimeError` * Pull python code out to external file
This commit is contained in:
@@ -28,6 +28,7 @@ configure_file(__init__.py.template ${NAMESPACE_INIT})
|
||||
|
||||
set(EXT_FILES
|
||||
freecad_doc.py
|
||||
module_io.py
|
||||
part.py
|
||||
partdesign.py
|
||||
project_utility.py
|
||||
|
||||
13
src/Ext/freecad/module_io.py
Normal file
13
src/Ext/freecad/module_io.py
Normal file
@@ -0,0 +1,13 @@
|
||||
def OpenInsertObject(importerModule, objectPath, importMethod, docName = ""):
|
||||
try:
|
||||
importArgs = []
|
||||
importKwargs = {}
|
||||
|
||||
if docName:
|
||||
importArgs.append(docName)
|
||||
if hasattr(importerModule, "importOptions"):
|
||||
importKwargs["options"] = importerModule.importOptions(objectPath)
|
||||
|
||||
getattr(importerModule, importMethod)(objectPath, *importArgs, **importKwargs)
|
||||
except PyExc_FC_AbortIOException:
|
||||
pass
|
||||
Reference in New Issue
Block a user