mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 06:39:13 +00:00
ifcpatch.execute - make input attribute optional
e.g. MergeDuplicateTypes doesn't use it in the code either way
This commit is contained in:
@@ -69,13 +69,12 @@ def execute(args):
|
|||||||
if "log" in args:
|
if "log" in args:
|
||||||
logging.basicConfig(filename=args["log"], filemode="a", level=logging.DEBUG)
|
logging.basicConfig(filename=args["log"], filemode="a", level=logging.DEBUG)
|
||||||
logger = logging.getLogger("IFCPatch")
|
logger = logging.getLogger("IFCPatch")
|
||||||
ifc_file = args["input"]
|
|
||||||
recipes = getattr(__import__("ifcpatch.recipes.{}".format(args["recipe"])), "recipes")
|
recipes = getattr(__import__("ifcpatch.recipes.{}".format(args["recipe"])), "recipes")
|
||||||
recipe = getattr(recipes, args["recipe"])
|
recipe = getattr(recipes, args["recipe"])
|
||||||
if recipe.Patcher.__init__.__doc__ is not None:
|
if recipe.Patcher.__init__.__doc__ is not None:
|
||||||
patcher = recipe.Patcher(args["input"], args["file"], logger, *args["arguments"])
|
patcher = recipe.Patcher(args.get("input"), args["file"], logger, *args["arguments"])
|
||||||
else:
|
else:
|
||||||
patcher = recipe.Patcher(args["input"], args["file"], logger, args["arguments"])
|
patcher = recipe.Patcher(args.get("input"), args["file"], logger, args["arguments"])
|
||||||
patcher.patch()
|
patcher.patch()
|
||||||
output = getattr(patcher, "file_patched", patcher.file)
|
output = getattr(patcher, "file_patched", patcher.file)
|
||||||
return output
|
return output
|
||||||
|
|||||||
@@ -53,10 +53,10 @@ class Patcher:
|
|||||||
.. code:: python
|
.. code:: python
|
||||||
|
|
||||||
# Default behaviour of merging by Tag attribute
|
# Default behaviour of merging by Tag attribute
|
||||||
ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "MergeDuplicateTypes", "arguments": []})
|
ifcpatch.execute({"file": model, "recipe": "MergeDuplicateTypes", "arguments": []})
|
||||||
|
|
||||||
# Explicitly say we want to merge based on the Name attribute
|
# Explicitly say we want to merge based on the Name attribute
|
||||||
ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "MergeDuplicateTypes", "arguments": ["Name"]})
|
ifcpatch.execute({"file": model, "recipe": "MergeDuplicateTypes", "arguments": ["Name"]})
|
||||||
"""
|
"""
|
||||||
self.src = src
|
self.src = src
|
||||||
self.file = file
|
self.file = file
|
||||||
|
|||||||
Reference in New Issue
Block a user