New utility to get IFC all elements that are relevant in Brickschema

This commit is contained in:
Dion Moult
2022-01-10 17:31:42 +11:00
parent 7a6df49348
commit 9b77bb6e37
2 changed files with 22 additions and 3 deletions
@@ -17,4 +17,16 @@ def get_brick_type(element):
result = ifc4_to_brick_map.get(f"{element.is_a()}.{predefined_type}", None)
if not result:
result = ifc4_to_brick_map.get(element.is_a(), None)
return result
if result:
return f"https://brickschema.org/schema/Brick#{result}"
def get_brick_elements(ifc_file):
classes = {c.split(".")[0] for c in ifc4_to_brick_map.keys()}
elements = []
for ifc_class in classes:
try:
elements += ifc_file.by_type(ifc_class)
except:
pass
return elements