Showing results for 
Search instead for 
Do you mean 
Reply

Assign a material to a mesh

Hi everybody, 

 

I would like to assign a material directly to a mesh (and not a mesh collector). 

I tried different ways but none worked. 

 

With MaterialOptions:

MaterialOptions newMatOp =vfemPart.NewMaterialOptions();
newMatOp.Material = physicalMaterial1;
newMatOp.MaterialInherited = false;
meshLast.ElementPropertyTable.SetPhysicalMaterialPropertyValue("material", newMatOp);

 

With SetMaterialProperty value

meshLast.ElementPropertyTable.SetMaterialPropertyValue("material", false, physicalMaterial1);\

 

They both end up with the error : "A Property with this name could not be found". 

 

I checked the name of the properties defined in the ElementPropertyTable, and there is no material defined, but I want to create one. 

 

As the SetMaterialPropertyValue exists, I guess it is possible to assign material. 

 

Someone knows how to do ? 

Thank you