Alice Caspari

Update the Configuration Properties "Description" to equal a Custom Property

Discussion created by Alice Caspari on Nov 30, 2018

In case someone has a use for this.....

 

' This code updates the Configuration Properties "Description" to equal that configurations Custom Property "ITEMMASTER"

' ******************************************************************************

 

Option Explicit

Dim swApp As SldWorks.SldWorks

Dim Part As SldWorks.PartDoc

Dim Doc As SldWorks.ModelDoc2

Dim SelMgr As SldWorks.SelectionMgr

 

 

Sub main()

    Set swApp = Application.SldWorks

    Set Doc = swApp.ActiveDoc

    Set SelMgr = Doc.SelectionManager

   

    Dim params As Variant

    params = Doc.GetConfigurationNames

    Dim vName As Variant

    Dim Name As String

    Dim thisConfig As Configuration

    Dim swModel As SldWorks.ModelDoc2

    Dim cusPropMgr As SldWorks.CustomPropertyManager

    Dim lRetVal As String

    Dim FieldName As String

    Dim vPropNames As Variant

    Dim vPropTypes As Variant

    Dim vPropValues As Variant

    Dim ValOut As String

    Dim ResolvedValOut As String

    Dim wasResolved As Boolean

    Dim resolved As Variant

   

    For Each vName In params

        Name = vName

        Set thisConfig = Doc.GetConfigurationByName(Name)

        Set cusPropMgr = thisConfig.CustomPropertyManager

       

        '***Substitute the Custom Property name to be used instead of "ITEMMASTER" in the line below

       

        lRetVal = cusPropMgr.Get5("ITEMMASTER", False, ValOut, ResolvedValOut, wasResolved)

         thisConfig.Description = ValOut

              

    Next vName

  

End Sub

Outcomes