ifcpatch.execute - make input attribute optional

e.g. MergeDuplicateTypes  doesn't use it in the code either way
This commit is contained in:
Andrej730
2024-02-05 16:23:16 +05:00
parent 39eed06e90
commit b503463a02
2 changed files with 4 additions and 5 deletions
+2 -3
View File
@@ -69,13 +69,12 @@ def execute(args):
if "log" in args:
logging.basicConfig(filename=args["log"], filemode="a", level=logging.DEBUG)
logger = logging.getLogger("IFCPatch")
ifc_file = args["input"]
recipes = getattr(__import__("ifcpatch.recipes.{}".format(args["recipe"])), "recipes")
recipe = getattr(recipes, args["recipe"])
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:
patcher = recipe.Patcher(args["input"], args["file"], logger, args["arguments"])
patcher = recipe.Patcher(args.get("input"), args["file"], logger, args["arguments"])
patcher.patch()
output = getattr(patcher, "file_patched", patcher.file)
return output
@@ -53,10 +53,10 @@ class Patcher:
.. code:: python
# 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
ifcpatch.execute({"input": "input.ifc", "file": model, "recipe": "MergeDuplicateTypes", "arguments": ["Name"]})
ifcpatch.execute({"file": model, "recipe": "MergeDuplicateTypes", "arguments": ["Name"]})
"""
self.src = src
self.file = file