Compare commits

...

3 Commits

Author SHA1 Message Date
Jedd Morgan b8df655fa4 Merge branch 'main' into bilal/cxpla-246-add-support-for-element-quantities 2025-08-26 15:07:17 +01:00
bimgeek 86ac9a2b91 cleanup 2025-08-18 17:20:55 +03:00
bimgeek af39a52f42 add qtos 2025-08-18 17:10:12 +03:00
+14 -1
View File
@@ -1,7 +1,7 @@
from typing import Any
from ifcopenshell.entity_instance import entity_instance
from ifcopenshell.util.element import get_type
from ifcopenshell.util.element import get_psets, get_type
def extract_properties(element: entity_instance) -> dict[str, object]:
@@ -10,6 +10,11 @@ def extract_properties(element: entity_instance) -> dict[str, object]:
"Property Sets": _get_ifc_object_properties(element),
}
# Add quantities if they exist
quantities = _get_quantities(element)
if quantities:
properties["Quantities"] = quantities
if (ifc_type := get_type(element)) is not None:
properties["Element Type Property Sets"] = _get_ifc_element_type_properties(
ifc_type,
@@ -90,3 +95,11 @@ def _get_properties(properties: entity_instance) -> dict[str, Any]:
# elif prop.is_a("IfcPropertyTableValue"):
# properties[name] = #not sure if we want to support these...
return result
def _get_quantities(element: entity_instance) -> dict[str, object]:
"""
Extract quantity takeoffs (QTOs) from an IFC element.
"""
quantities = get_psets(element, qtos_only=True)
return quantities if quantities else {}