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

@X2RESTON, here is a quick example, where both selected components have an iMate named "iMate2"

 

oSet = ThisApplication.ActiveDocument.CreateHighlightSet

oMsg = "Select 1st (press ESC to continue)"
Dim oOcc1 As ComponentOccurrence = ThisApplication.CommandManager.Pick _
	(SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, oMsg)

' If nothing gets selected then exit
If IsNothing(oOcc1) Then Exit Sub
oSet.AddItem(oOcc1)

oMsg = "Select 2nd part (press ESC to continue)"
Dim oOcc2 As ComponentOccurrence = ThisApplication.CommandManager.Pick _
	(SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, oMsg)

' If nothing gets selected then exit
If IsNothing(oOcc2) Then Exit Sub
oSet.AddItem(oOcc2)

Constraints.AddByiMates("", oOcc1.Name,"iMate2", oOcc2.Name, "iMate2")

oSet.Clear