Retrieve the material list (.sldmat) in a userbox (combobox)

Hello

I'm looking to retrieve in the form of a list via VBA in a combobox the list of existing Solidworks materials (Sldmat file).

This is in order to select the right material from this list and fill in a configuration. I create a personalized userbox that would best meet all my needs, which is unfortunately not the case with the standard Solidworks tool.

I have carried out several tests following the information from Solidworks but nothing is conclusive.

If someone has a code that works (SW2015), I 'm a taker.

Thanking you.

Cdt 

 

Hello

A macro is available here:

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

See also:

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

I have been able to extract the list of favorite materials but not from the API.  It is stored in the registry for each individual user.  You need to use wsHost.RegRead to get all the entries.  Take a look at this key:

"HKEY_CURRENT_USER\Software\Solidworks\SolidWorks 2015\Material\"

That being said, I think you are on a better track to use a specific custom materials file, since that can be set up with a common list for everyone, while each user's favorites will differ.

Hello

I created all the materials I need with their property as well as the custom properties that are retrieved in the cartridge

The attached file is compatible with 2015


matiere.7z

Edit: actually no... Message to delete
 

 

1 Like