4 Replies Latest reply on Oct 7, 2013 8:17 AM by Brian Mick

    Update Custom Property Tab with VBA in Equations

    Brian Mick

      Hello all,


      I'm trying to get my Custom Property for "Material" to pull the name from the solidworks material that I've assigned to my part.  See picture below:




      I'd like it to happen automatically or upon part rebuild. After a lot of research, I found that Josh Brady has a great presentation on how to get solidworks VBA code to run through equations.  However, they neutered this capability in Solidworks 2012, so I had to be more creative: Using more advice from Josh Brady, I am using equations to reference custom properties which contain the VBA code I need to get my material from one place to another.  See pictures below:


      Here is the equation:



      Here are the custom code properties




      And here is the custom property referenced in the custom property Tab that we are trying to set (it's configuration specific, but for now I'm only worried about setting the "Default" configuration, although down the line I'd like to be able to set the material to the "Active" configuration)




      As of now, my code works.  However, in order to update my custom property tab, I have to do the following:


      1. Change the material.

      2. Click "Rebuild"

      3. Open the "Properties" dialog.  This shows the correct material (it is updated).

      4. Open the custom property tab.  It now shows the correct material.


      If step 3 is omitted, then the Custom Property Tab does not update to the new material.  Any idea why? I'd like to not be opening the properties dialog every time I change material, that ruins the idea of automatically updating the Custom Property.  At that point I might as well open my custom property tab and just change the material myself.