Add feature to get parent of a particular IFC class

This commit is contained in:
Dion Moult
2026-03-20 23:10:00 +11:00
parent 7b6e82a9cc
commit d0f20371bd
3 changed files with 50 additions and 6 deletions
@@ -440,13 +440,13 @@ def _get_element_value(element: ifcopenshell.entity_instance, keys: list[str]) -
elif key == "container":
value = ifcopenshell.util.element.get_container(value)
elif key == "space":
value = ifcopenshell.util.element.get_container(value, ifc_class="IfcSpace")
value = ifcopenshell.util.element.get_parent(value, ifc_class="IfcSpace")
elif key == "storey":
value = ifcopenshell.util.element.get_container(value, ifc_class="IfcBuildingStorey")
value = ifcopenshell.util.element.get_parent(value, ifc_class="IfcBuildingStorey")
elif key == "building":
value = ifcopenshell.util.element.get_container(value, ifc_class="IfcBuilding")
value = ifcopenshell.util.element.get_parent(value, ifc_class="IfcBuilding")
elif key == "site":
value = ifcopenshell.util.element.get_container(value, ifc_class="IfcSite")
value = ifcopenshell.util.element.get_parent(value, ifc_class="IfcSite")
elif key == "parent":
value = ifcopenshell.util.element.get_parent(value)
elif key in ("types", "occurrences"):