AnsweredAssumed Answered

Getting Configuration Specific Description Instead of Default Part Description

Question asked by Vincent Piazza on Jun 18, 2013
Latest reply on Jun 18, 2013 by Vincent Piazza



As the title says, I have a macro that, among other things, gets the description for the part. The only problem is that sometimes one of the parts will have a different description under one of the referenced configurations tab than the one that appears on the default tab. The macro is getting the default part description when I would like it to get the desciption that is under the referenced configuration tab.


Here is the function that is currently getting me the descriptions:



Private Function GetCustomProperty(myComp As IComponent2, myProp As String) As String

    Dim myDoc As ModelDoc2

    Dim sa As Variant

    Dim i As Integer

    Dim myVal As String

    Dim myValOut As String

    Dim myMgr As ICustomPropertyManager

    Dim retB As Boolean


    Set myDoc = myComp.GetModelDoc2

    If myDoc Is Nothing Then Exit Function 'This will happen if you load your assembly lightweight

    Set myMgr = myDoc.Extension.CustomPropertyManager("")

    GetCustomProperty = ""

    sa = myMgr.GetNames

    If IsEmpty(sa) Then Exit Function

    For i = 0 To UBound(sa)

        If sa(i) = myProp Then

            retB = myMgr.Get4(sa(i), False, myVal, myValOut)


            GetCustomProperty = myValOut

            Exit Function

        End If


End Function


I can post more code if need be.