Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

You can do it like this:

Dim doc As AssemblyDocument = ThisDoc.Document
Dim occurrences = doc.ComponentDefinition.Occurrences
' Summary:
'     Method that adds a new occurrence into the assembly. This method is the equivalent
'     of using the Place Component command with the "Use iMate" check box checked.
'     The method returns a failure if no matches are found.
'
' Parameters:
'   FullDocumentName:
'     Input string that specifies the full document name of the part or the sub-assembly.
'     If only the FullFileName is specified, the master document within the file is
'     used.
'
'   PlaceAllMatching:
'     Optional input Boolean that indicates whether to place multiple components corresponding
'     to all iMate definition matches in the assembly. If specified to be True, multiple
'     ComponentOccurrences could be returned. If specified to be False, a single ComponentOccurrence
'     corresponding to the first match is returned.
'
'   Options:
'     Input NameValueMap object that specifies additional options for creating the
'     occurrence. (An empty NameValueMap object can be provided). See Remarks for valid
'     options.
occurrences.AddUsingiMates(FullDocumentName)

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com