File size: 615 Bytes
985c397 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # SPDX-License-Identifier: LGPL-2.1-or-later
from FreeCAD import Base
import importlib
def OpenInsertObject(importerName, objectPath, importMethod, docName = ""):
try:
importArgs = []
importKwargs = {}
importerModule = importlib.import_module(importerName)
if docName:
importArgs.append(docName)
if hasattr(importerModule, "importOptions"):
importKwargs["options"] = importerModule.importOptions(objectPath)
getattr(importerModule, importMethod)(objectPath, *importArgs, **importKwargs)
except Base.AbortIOException:
pass
|