Hello,
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:
<p> Private Function GetCustomProperty(myComp As IComponent2, myProp As String) As String</p><p> Dim myDoc As ModelDoc2</p><p> Dim sa As Variant</p><p> Dim i As Integer</p><p> Dim myVal As String</p><p> Dim myValOut As String</p><p> Dim myMgr As ICustomPropertyManager</p><p> Dim retB As Boolean</p><p></p><p> Set myDoc = myComp.GetModelDoc2</p><p> If myDoc Is Nothing Then Exit Function 'This will happen if you load your assembly lightweight</p><p> Set myMgr = myDoc.Extension.CustomPropertyManager("")</p><p> GetCustomProperty = ""</p><p> sa = myMgr.GetNames</p><p> If IsEmpty(sa) Then Exit Function</p><p> For i = 0 To UBound(sa)</p><p> If sa(i) = myProp Then</p><p> retB = myMgr.Get4(sa(i), False, myVal, myValOut)</p><p> </p><p> GetCustomProperty = myValOut</p><p> Exit Function</p><p> End If</p><p> Next</p><p>End Function</p><p></p>I can post more code if need be.
SolidworksApi macros