weight calculator improvement (see #2859)

This commit is contained in:
Massimo Fabbro
2023-03-13 08:26:26 +01:00
committed by Dion Moult
parent 94f06d9e18
commit 08fdf6014d
@@ -530,18 +530,14 @@ class QtoCalculator:
else: else:
return return
def get_single_material_mass_density(self, material): def get_single_material_mass_density(self, material):
for material_property in material.HasProperties: if material_pset := ifcopenshell.util.element.get_pset(material, "Pset_MaterialCommon"):
if "Pset_MaterialCommon" in material_property.Name: if material_mass_density := material_pset["MassDensity"]:
for prop in material_property.Properties: return material_mass_density
if "MassDensity" in prop:
return prop.NominalValue.wrappedValue
else: else:
return return
# The following is @Moult's older code. Keeping it here just in case the bmesh function is buggy. -vulevukusej # The following is @Moult's older code. Keeping it here just in case the bmesh function is buggy. -vulevukusej
# def get_volume(self, o, vg_index=None): # def get_volume(self, o, vg_index=None):