For reasons, i want to get the material of a part, have it removed, then have it reapplied.
This is part of an API Add-in written in VB.NET
Use 2014 SolidWorks API Help - GetMaterialPropertyName2 Method (IPartDoc)
and 2014 SolidWorks API Help - SetMaterialPropertyName2 Method (IPartDoc).
The material is removed if you set IPartDoc::SetMaterialPropertyName2("", "", "")
To get the full path of the database you have to add some more code... see this example.
I have also found that using multiple databases with same name might make SolidWorks to pick the wrong material.
And note that the material might be different for each configuration in the part, therefore I would recommend that you loop this thru for each configuration.
Great, got it working
It was the: IPartDoc::SetMaterialPropertyName2("", "", "") thing i was missing.
Also that 'GetMaterialDatabases' could come in handly.
Retrieving data ...