0

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.

Alexander Petrov
  • 13,457
  • 2
  • 20
  • 49
Yula k
  • 5
  • 1

1 Answers1

0

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.

Martin Cerny
  • 344
  • 3
  • 9
  • It works! not for all walls, Some walls are null in HasAssociations but they have Total thickness threw the Material property like I wrote in the question. Do you have a way to get it threw Material? – Yula k Jun 02 '21 at 08:22
  • You may want to try to get if from the related IfcWallType. – Martin Cerny Jun 02 '21 at 11:56
  • I managed with the BoundingBox, thank you! – Yula k Jun 06 '21 at 08:11