From b5c1eec1c9bba09cbdfeccf4bc0f1579832c48eb Mon Sep 17 00:00:00 2001 From: milovann Date: Sat, 3 Feb 2024 13:27:29 +0100 Subject: [PATCH] otuput --- output/.gitignore | 1 + output/README.md | 1 + python/Makefile | 12 ++++++++++++ python/extract.py | 9 ++++----- 4 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 output/.gitignore create mode 100644 output/README.md create mode 100644 python/Makefile diff --git a/output/.gitignore b/output/.gitignore new file mode 100644 index 0000000..5c89ded --- /dev/null +++ b/output/.gitignore @@ -0,0 +1 @@ +*.ifc diff --git a/output/README.md b/output/README.md new file mode 100644 index 0000000..22e0f66 --- /dev/null +++ b/output/README.md @@ -0,0 +1 @@ +# Output diff --git a/python/Makefile b/python/Makefile new file mode 100644 index 0000000..522bead --- /dev/null +++ b/python/Makefile @@ -0,0 +1,12 @@ +# https://stackoverflow.com/questions/6273608/how-to-pass-argument-to-makefile-from-command-line +args = `arg="$(filter-out $@,$(MAKECMDGOALS))" && echo $${arg:-${1}}` +create: + python3 create.py +extract: + python3 extract.py $(call args,none) +arguments: + @echo action $(filter-out $@,$(MAKECMDGOALS)) +test: + @echo $(call args, default) +%: # thanks to chakrit + @: # thanks to William Pursell diff --git a/python/extract.py b/python/extract.py index 7c0b334..f49d90a 100644 --- a/python/extract.py +++ b/python/extract.py @@ -67,22 +67,21 @@ def create(name,objects): print("adding",item) run("spatial.assign_container", model, relating_structure=storey, product=item) - model.write(name) if len(sys.argv) > 1: arg = sys.argv[1] print(f">> filename:{arg}") if (arg == "list"): - print(os.listdir("./files")) - p = "./files/" + arg + ".ifc" + print(os.listdir("../ifc")) + p = "../ifc/" + arg + ".ifc" if os.path.exists(p): model = load_model(p) lst = get_walls(model) select(model,"IfcBuildingStorey") - create("test.ifc",lst) + create("../output/test.ifc",lst) else: - print(os.listdir("./files")) + print(os.listdir("../ifc")) else: print("extract [filepath]")