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:
return
def get_single_material_mass_density(self, material):
for material_property in material.HasProperties:
if "Pset_MaterialCommon" in material_property.Name:
for prop in material_property.Properties:
if "MassDensity" in prop:
return prop.NominalValue.wrappedValue
if material_pset := ifcopenshell.util.element.get_pset(material, "Pset_MaterialCommon"):
if material_mass_density := material_pset["MassDensity"]:
return material_mass_density
else:
return
# 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):