ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
AKAndreas Killer15/01/2016

I'm developing a macro to create SLDLFP files from our component list (in Excel).

Creating the SLDLFP files, edit the sketch, set new dimension values, etc. is no problem, but the material part is not nice.

In our custom SW material database we have many materials with extended names, so I have e.g. to use this to set the material properly:

Set swApp = Application.SldWorks

Set swPart = swApp.ActiveDoc

swPart.SetMaterialPropertyName2 "Standard", "K:/Software/Solidworks/Vorlagen/Materialien.sldmat", "1.4404 (X2CrNiMo17-12-2)"

In our Excel list only the part "1.4404" is available, but SetMaterialPropertyName2 needs the extended name.

I've seen that I can get the material databases with swApp.GetMaterialDatabases

I wonder if there is a way to read all materials (items) from a database (into a collection or Array)?

Then I could search for the material from our Excel file in all items and get the extended Name.

Regards, Andreas.