Closed GVladislavG closed 1 year ago
Right code sample
typeId = model.Metadata.ExpressTypeId("IFCRELASSOCIATESMATERIAL");
IIfcRelAssociatesMaterial assMat = model.Instances.New(model.Metadata.GetType(typeId)) as IIfcRelAssociatesMaterial;
assMat.RelatingMaterial = MatLayerSet;
assMat.RelatedObjects.Add(ifcProduct);
Glad you sorted it. That material-layer-set diagram actually shows the attributes to use. I think could have also done:
// assMat.RelatedObjects.Add(ifcProduct);
ifcProduct.HasAssociations.Add(assMat);
BTW, rather than use the Express type to get schema independence you should be able to use this approach which avoids the casting and string literals.
var factory=new Create(model); // Factory to create the correct entity type for the schema
IIfcRelAssociatesMaterial assMat = factory.RelAssociatesMaterial(mat =>
{
mat.RelatingMaterial = MatLayerSet;
mat.RelatedObjects.Add(ifcProduct);
});
Hello, team! I try to attach IfcMaterialLayerSet to IfcProduct. But can't understand how to do it because IfcProduct.Material is null and can't be set directly. I thought code should look like this
But it doesn't work.
I also tried this code according to https://buildingsmart.github.io/ProductData/schema/templates/material-layer-set.html
No result, unfortunately.
Thank you!