In the basic operations in the xbim examples https://docs.xbim.net/examples/basic-model-operations.html, it shows how to retrieve the single value properties of a specific IfcElement. Based on this I've tried to get the material data.
I've written the following:
var id = "3NBPkknun6EuV9fpeE6rFh";
var theWall = model.Instances.FirstOrDefault<IIfcElement>(d => d.GlobalId == id);
var materials = theWall.HasAssociations
.Where(r => r.RelatingMaterial is IIfcMaterialProfileSet)
.SelectMany(r=> ((IIfcMaterialProfileSet)r.RelatingMaterial).MaterialProfiles)
.OfType<IIfcMaterialProfile>();
It gives me this error:
'IIfcRelAssociates' does not contain a definition for 'RelatingMaterial' and no accessible extension method 'RelatingMaterial' accepting a first argument of type 'IIfcRelAssociates' could be found (are you missing a using directive or an assembly reference?)
I understand that I have to use the IfcRelAssociatesMaterial, but I can't figure how. How can I retrieve the material information?