Skip to content

Commit 05be0f6

Browse files
committed
Fix #6305
Fix wrong calculation with blender engine for IfcFooting
1 parent 3f82357 commit 05be0f6

3 files changed

Lines changed: 29 additions & 2 deletions

File tree

src/bonsai/bonsai/bim/module/qto/calculator.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,18 @@ def get_stair_length(obj: bpy.types.Object) -> float:
9595
stair_length = math.sqrt(pow(length, 2) + pow(height, 2))
9696
return stair_length
9797

98+
def get_footing_length(o: bpy.types.Object) -> float:
99+
element = tool.Ifc.get_entity(o)
100+
assert element
101+
predefined_type = ifcopenshell.util.element.get_predefined_type(element)
102+
if not predefined_type:
103+
return get_length(o)
104+
if predefined_type == "FOOTING_BEAM" or predefined_type == "STRIP_FOOTING":
105+
return get_z(o)
106+
elif predefined_type == "PAD_FOOTING":
107+
return max(get_x(o), get_y(o))
108+
else:
109+
return get_length(o)
98110

99111
def get_net_stair_area(obj: bpy.types.Object) -> float:
100112
OBB_obj = get_OBB_object(obj)
@@ -174,6 +186,19 @@ def get_width(o: bpy.types.Object) -> float:
174186
y = get_y(o)
175187
return min(x, y)
176188

189+
def get_footing_height(o: bpy.types.Object) -> float:
190+
element = tool.Ifc.get_entity(o)
191+
assert element
192+
predefined_type = ifcopenshell.util.element.get_predefined_type(element)
193+
if not predefined_type:
194+
return get_height(o)
195+
if predefined_type == "FOOTING_BEAM" or predefined_type == "STRIP_FOOTING":
196+
return get_y(o)
197+
elif predefined_type == "PAD_FOOTING":
198+
return get_z(o)
199+
else:
200+
return get_height(o)
201+
177202

178203
def get_height(o: bpy.types.Object) -> float:
179204
"""_summary_: Returns the height of the object bounding box

src/ifc5d/ifc5d/IFC4QtoBaseQuantitiesBlender.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,8 @@
318318
"GrossSurfaceArea": "get_gross_surface_area",
319319
"GrossVolume": "get_gross_volume",
320320
"GrossWeight": "get_gross_weight",
321-
"Height": "get_height",
322-
"Length": "get_length",
321+
"Height": "get_footing_height",
322+
"Length": "get_footing_length",
323323
"NetVolume": "get_net_volume",
324324
"NetWeight": "get_net_weight",
325325
"OuterSurfaceArea": "get_outer_surface_area",

src/ifc5d/ifc5d/qto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,8 @@ class Blender(QtoCalculator):
441441
"get_rectangular_perimeter": Function("IfcLengthMeasure", "Rectangular Perimeter", ""),
442442
"get_stair_length": Function("IfcLengthMeasure", "Stair Length", ""),
443443
"get_width": Function("IfcLengthMeasure", "Width", ""),
444+
"get_footing_height": Function("IfcLengthMeasure", "Height", ""),
445+
"get_footing_length": Function("IfcLengthMeasure", "Length", ""),
444446
# IfcAreaMeasure
445447
"get_covering_gross_area": Function("IfcAreaMeasure", "Covering Gross Area", ""),
446448
"get_covering_net_area": Function("IfcAreaMeasure", "Covering Net Area", ""),

0 commit comments

Comments
 (0)