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]")