Fix wrong calculation with blender engine for IfcFooting
This commit is contained in:
Massimo Fabbro
2025-03-25 21:47:45 +01:00
committed by Massimo Fabbro
parent 3f823573cf
commit 05be0f69bd
3 changed files with 29 additions and 2 deletions
@@ -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
@@ -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",
+2
View File
@@ -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", ""),