mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 18:43:26 +00:00
improve the ceiling height object quantity calculation
This commit is contained in:
committed by
Massimo Fabbro
parent
09bb45f5bc
commit
e431cb205c
@@ -246,12 +246,19 @@ class QtoCalculator:
|
||||
return self.get_net_side_area(obj)
|
||||
|
||||
def get_finish_ceiling_height(self, obj: bpy.types.Object) -> float:
|
||||
space_height = self.get_height(obj)
|
||||
floor_height = self.get_finish_floor_height(obj)
|
||||
ceiling_height = self.get_ceiling_height(obj)
|
||||
finish_ceiling_height = space_height - floor_height - ceiling_height
|
||||
finish_ceiling_height = ceiling_height - floor_height
|
||||
return finish_ceiling_height
|
||||
|
||||
def get_max_global_z(self, obj: bpy.types.Object) -> float:
|
||||
z_values = [(obj.matrix_world @ Vector(co))[2] for co in obj.bound_box]
|
||||
return max(z_values)
|
||||
|
||||
def get_min_global_z(self, obj: bpy.types.Object) -> float:
|
||||
z_values = [(obj.matrix_world @ Vector(co))[2] for co in obj.bound_box]
|
||||
return min(z_values)
|
||||
|
||||
def get_finish_floor_height(self, obj: bpy.types.Object) -> float:
|
||||
element = tool.Ifc.get_entity(obj)
|
||||
decompositions = ifcopenshell.util.element.get_decomposition(element)
|
||||
@@ -269,20 +276,23 @@ class QtoCalculator:
|
||||
return finish_floor_height
|
||||
|
||||
def get_ceiling_height(self, obj: bpy.types.Object) -> float:
|
||||
space_min_z_value = self.get_min_global_z(obj)
|
||||
space_max_z_value = self.get_max_global_z(obj)
|
||||
|
||||
element = tool.Ifc.get_entity(obj)
|
||||
decompositions = ifcopenshell.util.element.get_decomposition(element)
|
||||
finish_ceiling_height = 0
|
||||
ceiling_min_z_value = space_max_z_value
|
||||
for decomposition in decompositions:
|
||||
if (
|
||||
decomposition.get_info()["PredefinedType"] == "CEILING"
|
||||
and decomposition.get_info()["type"] == "IfcCovering"
|
||||
):
|
||||
ceiling_obj = tool.Ifc.get_object(decomposition)
|
||||
new_finish_ceiling_height = self.get_height(ceiling_obj)
|
||||
if new_finish_ceiling_height > finish_ceiling_height:
|
||||
finish_ceiling_height = new_finish_ceiling_height
|
||||
ceiling_z_value = self.get_min_global_z(ceiling_obj)
|
||||
if ceiling_z_value < space_max_z_value:
|
||||
ceiling_min_z_value = ceiling_z_value
|
||||
|
||||
return finish_ceiling_height
|
||||
return ceiling_min_z_value - space_min_z_value
|
||||
|
||||
def get_net_perimeter(self, o: bpy.types.Object) -> float:
|
||||
parsed_edges = []
|
||||
|
||||
Reference in New Issue
Block a user