From 35787b384580c551f871842bce432ebd9b3f7b8c Mon Sep 17 00:00:00 2001 From: milovann Date: Sat, 3 Feb 2024 13:49:55 +0100 Subject: [PATCH] python --- python/extract.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/python/extract.py b/python/extract.py index efa528c..e22c261 100644 --- a/python/extract.py +++ b/python/extract.py @@ -63,26 +63,33 @@ def create(name,objects): run("geometry.assign_representation", model, product=wall, representation=representation) run("spatial.assign_container", model, relating_structure=storey, product=wall) - for item in lst: + for item in objects: print("adding",item) run("spatial.assign_container", model, relating_structure=storey, product=item) model.write(name) -if len(sys.argv) > 1: +def compute(p): + model = load_model(p) + lst = get_walls(model) + select(model,"IfcBuildingStorey") + print("writing test.ifc") + create("../output/test.ifc",lst) + +if len(sys.argv) == 1: + arg = "duplex" + p = "../ifc/" + arg + ".ifc" + compute(p) +elif len(sys.argv) > 1: arg = sys.argv[1] print(f">> filename:{arg}") if (arg == "list"): 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("../output/test.ifc",lst) + compute(p) else: print(os.listdir("../ifc")) - else: print("extract [filepath]")