mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +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:
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user