5 Replies Latest reply on Jul 13, 2018 9:43 AM by Todd Bennett

    Delete configuration specific properties

    Todd Bennett

      Hey all, I just need something to delete all configuration specific properties.  I do not want the fields blanked out, I need them gone.

      It might be nice to be able to do the same for custom properties too.  Ya never know.

       

      Thanks,

      Todd

        • Re: Delete configuration specific properties
          Alex Burnett

          Have you looked into using the program #TASK (created by Central Innovation)? It seems to have that capability without customizing a macro for this specific purpose.

           

            • Re: Delete configuration specific properties
              Alex Burnett

              FYI, these arguments appear to give the desired result. Deletes all config custom properties but leaves the main ones.

               

              • Re: Delete configuration specific properties
                Todd Bennett

                That's cool, but I just want a quick and dirty click that takes care of everything.  I don't even want a dialog box or any questions; "terminate with extreme prejudice".

                • Re: Delete configuration specific properties
                  Fifi Riri

                  Hello,

                  Try this:

                   

                  Option Explicit

                  Dim swApp               As SldWorks.SldWorks

                  Dim swModel             As SldWorks.ModelDoc2

                  Dim swConfig            As SldWorks.Configuration

                  Dim swCustPropMgr       As SldWorks.CustomPropertyManager

                  Dim vPropNames          As Variant

                  Dim vPropName           As Variant

                  Dim configNames         As Variant

                  Dim configName          As Variant

                   

                  Sub main()

                      Set swApp = Application.SldWorks

                      Set swModel = swApp.ActiveDoc

                      configNames = swModel.GetConfigurationNames

                      For Each configName In configNames

                          Set swConfig = swModel.GetConfigurationByName(configName)

                          Debug.Print "Name of configuration     : " & swConfig.Name

                          Set swCustPropMgr = swConfig.CustomPropertyManager

                   

                          ' Get the names of the custom properties

                          vPropNames = swCustPropMgr.GetNames

                   

                          ' Delete each custom property

                          For Each vPropName In vPropNames

                              Debug.Print "   Delete custom property : " & vPropName

                              swCustPropMgr.Delete vPropName

                          Next

                      Next

                  End Sub