You can now switch contexts of of objects in bulk

This commit is contained in:
Dion Moult
2022-09-19 15:59:37 +10:00
parent 57e8e47061
commit 18387e7732
8 changed files with 58 additions and 37 deletions
+13 -1
View File
@@ -39,7 +39,19 @@ def execute(args):
else:
patcher = recipe.Patcher(args["input"], ifc_file, logger, args["arguments"])
patcher.patch()
return getattr(patcher, "file_patched", patcher.file)
output = getattr(patcher, "file_patched", patcher.file)
if isinstance(output, str):
with open(args["output"], "w") as text_file:
text_file.write(output)
return output
def write(output, filepath):
if isinstance(output, str):
with open(filepath, "w") as text_file:
text_file.write(output)
else:
output.write(filepath)
def extract_docs(
+2 -6
View File
@@ -34,15 +34,11 @@ print("# Loading IFC file ...")
args["input"] = ifcopenshell.open(args["input"])
print("# Patching ...")
ifc_file = ifcpatch.execute(args)
output = ifcpatch.execute(args)
print("# Writing patched file ...")
if not args["output"]:
args["output"] = args["input"]
if isinstance(ifc_file, str):
with open(args["output"], "w") as text_file:
text_file.write(ifc_file)
else:
ifc_file.write(args["output"])
ifcpatch.write(output, args["output"])
print("# All tasks are complete :-)")