1 Reply Latest reply on Aug 31, 2014 5:40 AM by Deepak Gupta

    delete Custom and Configuration Specific

    Yong Ning

      0.jpg

       

      delete Custom specific code is

       

      Private Sub t0831()

        Dim swModel As ModelDoc2

          Set swModel = Application.SldWorks.ActiveDoc

        Dim CustArr

          CustArr = swModel.GetCustomInfoNames

          For ii = 0 To UBound(CustArr)

            swModel.DeleteCustomInfo2 "", CustArr(ii)

          Next ii

          ''

      End Sub

       

       

       

       

      1.jpg

       

      Private Sub t0831()

        Dim swModel As ModelDoc2

          Set swModel = Application.SldWorks.ActiveDoc

        Dim CustArr

          CustArr = swModel.GetCustomInfoNames

          For ii = 0 To UBound(CustArr)

            swModel.DeleteCustomInfo2 "", CustArr(ii)

          Next ii    ''

      End Sub

       

      ***************

       

      Private Sub test0831()

        Dim swModel As ModelDoc2

          Set swModel = Application.SldWorks.ActiveDoc

        Dim SwConfMgr As ConfigurationManager

          Set SwConfMgr = swModel.ConfigurationManager

        Dim SwCustMgr As CustomPropertyManager, PropArr

       

        Dim SwConf As Configuration, ConfArr

          ConfArr = swModel.GetConfigurationNames

        Dim CustArr, valOut As String, resolvedValOut As String

          ''

          Set SwConf = swModel.GetActiveConfiguration

          Set SwCustMgr = SwConf.CustomPropertyManager

          CustArr = SwCustMgr.GetNames

       

          For ii = 0 To UBound(ConfArr)

            'SwCustMgr.Delete CustArr(ii)

            Set SwConf = swModel.GetConfigurationByName(ConfArr(ii))

            Set SwCustMgr = SwConf.CustomPropertyManager

            CustArr = SwCustMgr.GetNames

            'Stop

            For jj = 0 To UBound(CustArr)

               SwCustMgr.Get2 CustArr(jj), valOut, resolvedValOut

               Debug.Print SwConf.Name, CustArr(jj), valOut, resolvedValOut

               'Stop

            Next jj   

          Next ii      ''

      End Sub

       

       

       

      '

        • Re: delete Custom and Configuration Specific
          Deepak Gupta

          'Delete Configuration Properties

          Option Explicit

              Dim swApp                               As SldWorks.SldWorks

              Dim swModelDoc                      As SldWorks.ModelDoc2

              Dim swConfig                           As SldWorks.Configuration

              Dim swCustPropMgr                 As SldWorks.CustomPropertyManager

              Dim j                                          As Long

              Dim PropNames                       As Variant

          Sub Main()

             Set swApp = Application.SldWorks

             Set swModelDoc = swApp.ActiveDoc 

             Set swConfig = swModelDoc.ConfigurationManager.ActiveConfiguration

             Set swCustPropMgr = swConfig.CustomPropertyManager

           

             PropNames = swCustPropMgr.GetNames

           

              For j = 0 To swCustPropMgr.Count - 1

                      swCustPropMgr.Delete (PropNames(j))

              Next j

          End Sub