Hi,
I developed a macro feature which create bodies.
I need to apply a custom material to these bodies after the macro feature creation.
var feat = Doc.FeatureManager.InsertMacroFeature3(...);
if (feat == null)
throw new COMException("Unable to create feature", 1);
var faces = (object[])feat.GetFaces();
foreach (Face2 face in faces)
{
var body = (Body2)face.GetBody();
if (!body.HasMaterialPropertyValues())
{
var error = body.SetMaterialProperty(ConfigName, Database, MaterialName);
System.Diagnostics.Debug.Print(Enum.GetName(typeof(swBodyMaterialApplicationError_e), error));
// OUTPUT: "swBodyMaterialApplicationError_NoError" x No of faces
}
}
Despite of SetMaterialProperty returns NoError, the created bodies does not have any attached material.
Some help will be welcome.
Regards
SolidworksApi macros