Hi @josh.linares-stanley. I rarely work with iMates, so I work with them even less by code, but I do know that there are a few iLogic snippets for working with them. And I also know how to access or create them by Inventor API code, if that may help out a little.
The 4 iLogic snippets are basically for IsActive (suppression) type use, and for Add (create) type use.
Constraint.iMateDefIsActive("iMate:1")
Constraint.iMateDefIsActive("SubAssem:1", "iMate:1")
Constraints.AddByiMates("Mate1", "Part1:1", "iMate:1", "Part2:1", "iMate:1")
Constraints.AddByiMateAndEntity("Mate1", "Part1:1", "iMate:1", "Part2:1", "iMate:1", entityBiasPoint := Nothing, angleEntityReversed := False)
And the API route is of course a bit longer and more complex looking, depending on what you are trying to do with them. This is just one rough example of some code that can be used in an iLogic rule to access them:
Dim oPDoc As PartDocument = ThisDoc.Document
oPDef = oPDoc.ComponentDefinition
Dim iMateDefs As iMateDefinitions = oPDef.iMateDefinitions
Dim oCompIMateDef As CompositeiMateDefinition = Nothing
Dim oMatchList As String() = {}
If iMateDefs.Count > 0 Then
For Each oIMateDef As iMateDefinition In iMateDefs
If Not TypeOf oIMateDef Is CompositeiMateDefinition Then Continue For
If oIMateDef.Name = "MyCompositeiMateDef" Then
oCompIMateDef = oIMateDef
oMatchList = oCompIMateDef.MatchList
'can now alter the list if wanted/needed
'can also set new MatchList, or set altered MatchList
'oCompIMateDef.MatchList = oMatchList
'oCompIMateDef.SequenceIndex
'oCompIMateDef.Suppressed = False
End If
Next
End If
If IsNothing(oCompIMateDef) Then
Dim iMatesColl As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
'iMatesColl.Add(MyiMateDef1)
oCompIMateDef = iMateDefs.AddCompositeiMateDefinition(iMatesColl, "MyCompositeiMateDef", oMatchList)
End If
If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.
If you want and have time, I would appreciate your Vote(s) for My IDEAS :bulb: or you can Explore My CONTRIBUTIONS
Wesley Crihfield

(Not an Autodesk Employee)