Get TotalThickness value of IFCWALL element

113 Views Asked by At

How can I get the TotalThickness value of IFCWALL element using Xbim.Ifc2x3?

As I can see it is contained in wallElement.Material=>ForLayerSet=>TotalThickness or in wallElement.IsTypedBy=>Material=>TotalThickness but when I try to access it by code it wouldn't recognize TotalThickness property.

1

There are 1 best solutions below

3
On BEST ANSWER

Just sum up all the thicknesses of material layers. But don't forget to check that the material is actually a material layer set as it might be other type of material.

var thickness = 
    (ifcWall.HasAssociations.OfType<IfcRelAssociatesMaterial>()
    .FirstOrDefault()?.RelatingMaterial as IfcMaterialLayerSetUsage)?
    .ForLayerSet?.MaterialLayers.Sum(l => l.LayerThickness);

You obviously need to add more null checking logic and probably inspect other possible types of RelatingMaterial as well.