2 Replies Latest reply on Jan 31, 2016 9:44 PM by Adam Hoffman

    Macro to update config cutom properties

    Graeme Duffell

      Hi, Thanks in advance for any advice.

       

      I need a macro to transfer properties from the Cut-list-item 1 to custom properties of the current configuration of the part.

       

      Have come accros the one below but will only transfer to doc custom properties not the configurations. Any pointers on what needs to change?

       

      Cheers

       

      Dim swApp As SldWorks.SldWorks

      Dim swModel As SldWorks.ModelDoc2

      Dim swFeat As SldWorks.Feature

      Dim swCustPropMgr As SldWorks.CustomPropertyManager

      Dim strValue As String

         

      Sub main()

         

         

          Set swApp = Application.SldWorks

          Set swModel = swApp.ActiveDoc

          Set swFeat = swModel.FirstFeature

          Do While Not swFeat Is Nothing

              If swFeat.Name = "Cut-List-Item1" Then

                  Set swCustPropMgr = swFeat.CustomPropertyManager

                  swCustPropMgr.Get4 "Description", False, Empty, strValue

                 

                  Set swCustPropMgr = swModel.Extension.CustomPropertyManager(Empty)

                  swCustPropMgr.Set2 "Description", strValue

                 

                  Exit Do

              End If

              Set swFeat = swFeat.GetNextFeature

          Loop

      End Sub