Finish mapping mappable quantities with get_weight

This commit is contained in:
Massimo Fabbro
2023-03-12 18:28:08 +01:00
committed by Dion Moult
parent 93519c1c63
commit 154c4295df
3 changed files with 36 additions and 17 deletions
@@ -9,8 +9,8 @@ mapper = {
'NetArea' : "get_net_footprint_area",
'GrossVolume' : "get_gross_volume",
'NetVolume' : "get_net_volume",
'GrossWeight' : None,
'NetWeight' : None,
'GrossWeight' : "get_gross_weight",
'NetWeight' : "get_net_weight",
},
'Qto_OpeningElementBaseQuantities' : {
'Width' : "get_length",
@@ -36,8 +36,8 @@ mapper = {
'GrossSurfaceArea' : "get_gross_surface_area",
'GrossVolume' : "get_gross_volume",
'NetVolume' : "get_net_volume",
'GrossWeight' : None,
'NetWeight' : None,
'GrossWeight' : "get_gross_weight",
'NetWeight' : "get_net_weight",
},
'Qto_VibrationIsolatorBaseQuantities' : {
'GrossWeight' : None,
@@ -121,7 +121,7 @@ mapper = {
'Qto_RailBaseQuantities' : {
'Length' : "get_length",
'Volume' : "get_net_volume",
'Weight' : None,
'Weight' : "get_net_weight",
},
'Qto_PictorialSignQuantities' : {
'Area' : "get_net_side_area",
@@ -142,8 +142,8 @@ mapper = {
'GrossCrossSectionArea' : None,
'NetCrossSectionArea' : "get_cross_section_area",
'OuterSurfaceArea' : "get_outer_surface_area",
'GrossWeight' : None,
'NetWeight' : None,
'GrossWeight' : "get_gross_weight",
'NetWeight' : "get_net_weight",
},
'Qto_HumidifierBaseQuantities' : {
'GrossWeight' : None,
@@ -250,8 +250,8 @@ mapper = {
'NetArea' : "get_net_footprint_area",
'GrossVolume' : "get_gross_volume",
'NetVolume' : "get_net_volume",
'GrossWeight' : None,
'NetWeight' : None,
'GrossWeight' : "get_gross_weight",
'NetWeight' : "get_net_weight",
},
'Qto_ImpactProtectionDeviceBaseQuantities' : {
'Weight' : None,
@@ -292,7 +292,7 @@ mapper = {
'GrossVolume' : "get_gross_volume",
'NetVolume' : "get_net_volume",
'GrossWeight' : "get_gross_weight",
'NetWeight' : None,
'NetWeight' : "get_net_weight",
},
'Qto_PumpBaseQuantities' : {
'GrossWeight' : None,
@@ -314,8 +314,8 @@ mapper = {
'NetSurfaceArea' : "get_net_surface_area",
'GrossVolume' : "get_gross_volume",
'NetVolume' : "get_net_volume",
'GrossWeight' : None,
'NetWeight' : None,
'GrossWeight' : "get_gross_weight",
'NetWeight' : "get_net_weight",
},
'Qto_EarthworksCutBaseQuantities' : {
'Length' : "get_length",
@@ -387,7 +387,7 @@ mapper = {
'GrossVolume' : "get_gross_volume",
'NetVolume' : "get_net_volume",
'GrossWeight' : "get_gross_weight",
'NetWeight' : None,
'NetWeight' : "get_net_weight",
},
'Qto_StairFlightBaseQuantities' : {
'Length' : "get_stair_length",
@@ -477,7 +477,7 @@ mapper = {
'GrossVolume' : "get_gross_volume",
'NetVolume' : "get_net_volume",
'GrossWeight' : "get_gross_weight",
'NetWeight' : None,
'NetWeight' : "get_net_weight",
},
'Qto_SleeperBaseQuantities' : {
'Length' : "get_length",
@@ -537,8 +537,8 @@ mapper = {
'NetSurfaceArea' : "get_net_surface_area",
'GrossVolume' : "get_gross_volume",
'NetVolume' : "get_net_volume",
'GrossWeight' : None,
'NetWeight' : None,
'GrossWeight' : "get_gross_weight",
'NetWeight' : "get_net_weight",
},
'Qto_BodyGeometryValidation' : {
'GrossSurfaceArea' : "get_gross_surface_area",
@@ -3,7 +3,7 @@ So, here are some note needed to know about how quantities are calculated.
NET VOLUME AND GROSS VOLUME
The difference between gross volume and net volume is that the gross volume is calculated
without the related IFC opening.
So, if an object is created lets say with a hole but without defining the opening, the hole is counted into net volume (so get volume and net volume are the same).
So, if an object is created lets say with a hole but without defining the opening, the hole is counted into net volume (so gross volume and net volume are the same).
This is in order to follow the native IFC approach.
WALLS
@@ -31,6 +31,14 @@ NetFloorArea: it doesn't count the following entities contained in the spatial e
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
WEIGHT
The object weight is calculated by multiplying the object mass density with the object volume (net or gross).
It's only calculated if the object material has a MassDensity property in the Pset_MaterialCommon.
It's calculated also only if the material is a "IfcMaterial" or a "IfcMaterialLayerSetUsage" or a "IfcMaterialProfileSetUsage".
If the object material is a "IfcMaterialLayerSetUsage" the weight is calculated based on the average of layer thicknesses.
If the object material is a "IfcMaterialProfileSetUsage", the weight is calculated only if there is only one profile (for simplicity).
Also, at the moment there is no control over the measure unit so pay attention about that.
REMAINING TODO FUNCTIONS
@@ -480,9 +480,20 @@ class QtoCalculator:
gross_weight = obj_mass_density * gross_volume
return gross_weight
def get_net_weight(self, obj):
obj_mass_density = self.get_obj_mass_density(obj)
if not obj_mass_density:
return
net_volume = self.get_net_volume(obj)
net_weight = obj_mass_density * net_volume
return net_weight
def get_obj_mass_density(self, obj):
entity = tool.Ifc.get_entity(obj)
material = ifcopenshell.util.element.get_material(entity)
if material is None:
return
if (
material.is_a("IfcMaterialLayerSet")
or material.is_a("IfcMaterialProfileSet")