[VBA] Retrieved materials from a database

Hello

We have a database to manage our materials (Matières.SLDMAT) and I would like to retrieve the materials that this database contains via a macro.

I managed to retrieve the list of the different bases, but not the materials they contain. And the Solidworks documentation didn't help me much.

 

Thank you.

Hello

In fact it's an XML file, so you can open it with Excel and you have all the info.

I agree that it's an XML file,

but my goal would be to retrieve the categories and materials in order to add them in a ComboBox of a UserForm.

Ok, so some interesting info here:

The only way is to retrieve the path to material database using SldWorks::GetMaterialDatabases method and parse the .sldmat using XML-parsers.

 

http://help.solidworks.com/2012/English/api/sldworksapi/Set_Material_Example_VB.htm

https://forum.solidworks.com/thread/27515

http://help.solidworks.com/2015/english/api/sldworksapi/solidworks.interop.sldworks~solidworks.interop.sldworks.isldworks~getmaterialdatabases.html

 

1 Like

Hello 

Have you found a solution to your problem because I have exactly the same need?

Cdt