2 Replies Latest reply on Jan 22, 2014 2:18 PM by Ralph Gillis

    Changing SLDPRT "Drop down" material using API?

    Darren Smith

      Can anybody help?


      I recorded a macro that changed the material, on the Solidworks drop down list (Please see the attached screenshot)


      I changed the material manually to a different material type to test the macro that I had just recorded (please see the attached macro)


      It should have changed the material from "Stainless Steel Grade 316L" to "Mild Steel Grade EN10025-S275" but did not work.


      Has anybody any idea why it did not work?


      Many thanks in advance!!!



        • Re: Changing SLDPRT "Drop down" material using API?
          Simon Turner

          You are specifying the path to a material library:

          C:\ProgramData\SolidWorks\SolidWorks 2013\Custom Materials\solidworks materials.sldmat


          Firstly, does that file exist in that folder? solidworks materials.sldmat is a standard library of materials and usually lives in C:\Program FIles\SolidWorks Corp\SolidWorks\lang\English


          Secondly, solidworks materials.sldmat does not contain a Mild Steel Grade EN10025-S275


          Could it be a Custom Material? If so, put the correct path to that custom material library into the SetMaterialPropertyName2 line

          • Re: Changing SLDPRT "Drop down" material using API?
            Ralph Gillis

            Hi Darren,


            Excuse my ignorance but why would you need to create a macro to add a material to the material 'favorites' list?  If you simply edit the material to bring up the material list menu, you can select the 'Favorites' tab on the right. Assuming you have created a custom material, you can select it from the list on the left and choose the 'Add' button to include it to you favorites menu.