Mapping quantities (see #2533) (#2627)

* Finish mapping Qto_PileBaseQuantities

* Finish mapping IfcPipeSegmentBaseQuantities

* Finish mapping IfcVehicleBaseQuantities

* Finish mapping Qto_OpeningElementBaseQuantities

* Finish mapping Qto_PlateBaseQuantities

* Finish Qto_MarineFacilityBaseQuantities

* Finish Qto_FacilityPartBaseQuantities

* Finish Qto_ProjectionElementBaseQuantities

* Better syntax
This commit is contained in:
Massimo Fabbro
2022-12-02 18:19:43 +01:00
committed by GitHub
parent dbbbb52e9e
commit c8ba2b53c9
3 changed files with 66 additions and 38 deletions
@@ -3,39 +3,39 @@ mapper = {
'GrossWeight' : None,
},
'Qto_PlateBaseQuantities' : {
'Width' : None,
'Perimeter' : None,
'GrossArea' : None,
'NetArea' : None,
'GrossVolume' : None,
'NetVolume' : None,
'Width' : "get_height",
'Perimeter' : "get_gross_perimeter",
'GrossArea' : "get_gross_footprint_area",
'NetArea' : "get_net_footprint_area",
'GrossVolume' : "get_gross_volume",
'NetVolume' : "get_net_volume",
'GrossWeight' : None,
'NetWeight' : None,
},
'Qto_OpeningElementBaseQuantities' : {
'Width' : None,
'Height' : None,
'Depth' : None,
'Area' : None,
'Volume' : None,
'Width' : "get_length",
'Height' : "get_opening_height",
'Depth' : "get_opening_depth",
'Area' : "get_opening_mapping_area",
'Volume' : "get_net_volume",
},
'Qto_MarineFacilityBaseQuantities' : {
'Length' : None,
'Width' : None,
'Height' : None,
'Area' : None,
'Volume' : None,
'Length' : "get_length",
'Width' : "get_width",
'Height' : "get_height",
'Area' : "get_net_footprint_area",
'Volume' : "get_net_volume",
},
'Qto_ChillerBaseQuantities' : {
'GrossWeight' : None,
},
'Qto_PileBaseQuantities' : {
'Length' : None,
'CrossSectionArea' : None,
'OuterSurfaceArea' : None,
'GrossSurfaceArea' : None,
'GrossVolume' : None,
'NetVolume' : None,
'Length' : "get_length",
'CrossSectionArea' : "get_cross_section_area",
'OuterSurfaceArea' : "get_outer_surface_area",
'GrossSurfaceArea' : "get_gross_surface_area",
'GrossVolume' : "get_gross_volume",
'NetVolume' : "get_net_volume",
'GrossWeight' : None,
'NetWeight' : None,
},
@@ -46,9 +46,9 @@ mapper = {
'GrossWeight' : None,
},
'Qto_VehicleBaseQuantities' : {
'Length' : None,
'Width' : None,
'Height' : None,
'Length' : "get_length",
'Width' : "get_width",
'Height' : "get_height",
},
'Qto_PipeFittingBaseQuantities' : {
'Length' : None,
@@ -81,15 +81,15 @@ mapper = {
'GrossWeight' : None,
},
'Qto_FacilityPartBaseQuantities' : {
'Length' : None,
'Width' : None,
'Height' : None,
'Area' : None,
'Volume' : None,
'Length' : "get_length",
'Width' : "get_width",
'Height' : "get_height",
'Area' : "get_net_footprint_area",
'Volume' : "get_net_volume",
},
'Qto_ProjectionElementBaseQuantities' : {
'Area' : None,
'Volume' : None,
'Area' : "get_net_side_area",
'Volume' : "get_net_volume",
},
'Qto_SignBaseQuantities' : {
'Height' : None,
@@ -138,13 +138,12 @@ mapper = {
'NetArea' : "get_net_footprint_area",
},
'Qto_PipeSegmentBaseQuantities' : {
'Length' : None,
'Length' : "get_length",
'GrossCrossSectionArea' : None,
'NetCrossSectionArea' : None,
'OuterSurfaceArea' : None,
'NetCrossSectionArea' : "get_cross_section_area",
'OuterSurfaceArea' : "get_outer_surface_area",
'GrossWeight' : None,
'NetWeight' : None,
'FootPrintArea' : None,
},
'Qto_HumidifierBaseQuantities' : {
'GrossWeight' : None,
@@ -243,9 +242,9 @@ mapper = {
'GrossWeight' : None,
},
'Qto_SlabBaseQuantities' : {
'Width' : "get_height",
'Width' : "get_width",
'Length' : "get_length",
'Depth' : "get_width",
'Depth' : "get_height",
'Perimeter' : "get_gross_perimeter",
'GrossArea' : "get_gross_footprint_area",
'NetArea' : "get_net_footprint_area",
@@ -29,6 +29,7 @@ Also GrossWallArea and NetWallArea need bounding object so for the moment is sti
GrossFloorArea: following the definition, it should exclude the wall claddings, but for now, this is not considered into the calculation.
NetFloorArea: it doesn't count the following entities contained in the spatial entity: IfcColumn and IfcWall. Just add other entities into 'get_net_floor_area' if it's needed
NetVolume: like NetFloorArea, it doesn't count the following entities contained in the spatial entity: IfcColumn and IfcWall
Also, the entire IfcColumn (or IfcWall) object volume is substracted, so it should be better to substract only the shared volume between IfcSpace and IfcColumn. Look at todo list
@@ -36,4 +37,7 @@ REMAINING TODO FUNCTIONS
IfcSpace - NetPerimeter
IfcSpace - GrossWallArea
IfcSpace - NetWallArea
IfcSpace - Calculate only shared volume between IfcColumn and IfcSpace
IfcPipeSegment - Gross cross section area
Qto_PipeFittingBaseQuantities - Basically all quantities because the object can not be straight
@@ -138,6 +138,24 @@ class QtoCalculator:
"""
return (Vector(o.bound_box[1]) - Vector(o.bound_box[0])).length
def get_opening_height(self, obj):
if self.is_opening_horizontal(obj):
return self.get_width(obj)
else:
return self.get_height(obj)
def get_opening_depth(self, obj):
if self.is_opening_horizontal(obj):
return self.get_height(obj)
else:
return self.get_width(obj)
def get_opening_mapping_area(self, obj):
if self.is_opening_horizontal(obj):
return self.get_net_footprint_area(obj)
else:
return self.get_net_side_area(obj)
def get_finish_ceiling_height(self, obj):
space_height = self.get_height(obj)
floor_height = self.get_finish_floor_height(obj)
@@ -1063,6 +1081,13 @@ class QtoCalculator:
else:
return "x"
def is_opening_horizontal(self, o):
x = (Vector(o.bound_box[4]) - Vector(o.bound_box[0])).length
y = (Vector(o.bound_box[3]) - Vector(o.bound_box[0])).length
z = (Vector(o.bound_box[1]) - Vector(o.bound_box[0])).length
return z < x and z < y
def delete_mesh(self, mesh):
mesh.user_clear()
bpy.data.meshes.remove(mesh)