diff --git a/src/bonsai/bonsai/bim/module/qto/calculator.py b/src/bonsai/bonsai/bim/module/qto/calculator.py index 264a8fbf6b..81131ba21c 100644 --- a/src/bonsai/bonsai/bim/module/qto/calculator.py +++ b/src/bonsai/bonsai/bim/module/qto/calculator.py @@ -95,6 +95,18 @@ def get_stair_length(obj: bpy.types.Object) -> float: stair_length = math.sqrt(pow(length, 2) + pow(height, 2)) return stair_length +def get_footing_length(o: bpy.types.Object) -> float: + element = tool.Ifc.get_entity(o) + assert element + predefined_type = ifcopenshell.util.element.get_predefined_type(element) + if not predefined_type: + return get_length(o) + if predefined_type == "FOOTING_BEAM" or predefined_type == "STRIP_FOOTING": + return get_z(o) + elif predefined_type == "PAD_FOOTING": + return max(get_x(o), get_y(o)) + else: + return get_length(o) def get_net_stair_area(obj: bpy.types.Object) -> float: OBB_obj = get_OBB_object(obj) @@ -174,6 +186,19 @@ def get_width(o: bpy.types.Object) -> float: y = get_y(o) return min(x, y) +def get_footing_height(o: bpy.types.Object) -> float: + element = tool.Ifc.get_entity(o) + assert element + predefined_type = ifcopenshell.util.element.get_predefined_type(element) + if not predefined_type: + return get_height(o) + if predefined_type == "FOOTING_BEAM" or predefined_type == "STRIP_FOOTING": + return get_y(o) + elif predefined_type == "PAD_FOOTING": + return get_z(o) + else: + return get_height(o) + def get_height(o: bpy.types.Object) -> float: """_summary_: Returns the height of the object bounding box diff --git a/src/ifc5d/ifc5d/IFC4QtoBaseQuantitiesBlender.json b/src/ifc5d/ifc5d/IFC4QtoBaseQuantitiesBlender.json index 73bc99dc3b..43dd4b2842 100644 --- a/src/ifc5d/ifc5d/IFC4QtoBaseQuantitiesBlender.json +++ b/src/ifc5d/ifc5d/IFC4QtoBaseQuantitiesBlender.json @@ -318,8 +318,8 @@ "GrossSurfaceArea": "get_gross_surface_area", "GrossVolume": "get_gross_volume", "GrossWeight": "get_gross_weight", - "Height": "get_height", - "Length": "get_length", + "Height": "get_footing_height", + "Length": "get_footing_length", "NetVolume": "get_net_volume", "NetWeight": "get_net_weight", "OuterSurfaceArea": "get_outer_surface_area", diff --git a/src/ifc5d/ifc5d/qto.py b/src/ifc5d/ifc5d/qto.py index 6856d78fba..0938563c82 100644 --- a/src/ifc5d/ifc5d/qto.py +++ b/src/ifc5d/ifc5d/qto.py @@ -441,6 +441,8 @@ class Blender(QtoCalculator): "get_rectangular_perimeter": Function("IfcLengthMeasure", "Rectangular Perimeter", ""), "get_stair_length": Function("IfcLengthMeasure", "Stair Length", ""), "get_width": Function("IfcLengthMeasure", "Width", ""), + "get_footing_height": Function("IfcLengthMeasure", "Height", ""), + "get_footing_length": Function("IfcLengthMeasure", "Length", ""), # IfcAreaMeasure "get_covering_gross_area": Function("IfcAreaMeasure", "Covering Gross Area", ""), "get_covering_net_area": Function("IfcAreaMeasure", "Covering Net Area", ""),