How to search for a ipart component in an assembly with a keyword using ilogic

How to search for a ipart component in an assembly with a keyword using ilogic

Anonymous
Not applicable
232 Views
0 Replies
Message 1 of 1

How to search for a ipart component in an assembly with a keyword using ilogic

Anonymous
Not applicable

Hi,

 

I tried using the code:

 

Dim oAsmCompDef As AssemblyComponentDefinition
        oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
        
        'Iterate through all of the occurrences
        Dim oOccurrence As ComponentOccurrence
        
        For Each oOccurrence In oAsmCompDef.Occurrences
            Dim oName As String
            If oOccurrence.Name.contains("family name") And oOccurrence.Name.contains("instance number") Then
                oName = oOccurrence.Name
                If condition Then
                    oOccurrence.suppress
                    
                Else
                    oOccurrence.unsuppress
                End If
                            
                Exit For
            End If
            
        Next

 

 

 

 

this returns the name successfully only if the component is a normal part.

If it is an ipart, it returns "Nothing". How can I also get  the component name for an ipart

0 Likes
233 Views
0 Replies
Replies (0)