Hi @GeorgK,
Through UI, Constraint sets by selecting UCS does 3 flush constraints for YZ, XZ and XY planes of 2 UCS(User coordinate system). Unfortunately, No direct Inventor API is available.
But, same can be achieved by following VBA code.
Sub Main()
Dim oUCS1 As UserCoordinateSystem
Set oUCS1 = ThisApplication.CommandManager.Pick(kUserCoordinateSystemFilter, "Select a first UCS")
Dim oUCS2 As UserCoordinateSystem
Set oUCS2 = ThisApplication.CommandManager.Pick(kUserCoordinateSystemFilter, "Select a second UCS")
Dim oDOc As AssemblyDocument
Set oDOc = ThisApplication.ActiveDocument
Dim oDef As AssemblyComponentDefinition
Set oDef = oDOc.ComponentDefinition
Dim occDef1 As ComponentDefinition
Set occDef1 = oUCS1.Parent
Dim occ1 As ComponentOccurrence
For Each occ1 In oDef.Occurrences.AllLeafOccurrences
If occ1.Definition Is occDef1 Then
Exit For
End If
Next
Dim occDef2 As ComponentDefinition
Set occDef2 = oUCS2.Parent
Dim occ2 As ComponentOccurrence
For Each occ2 In oDef.Occurrences.AllLeafOccurrences
If occ2.Definition Is occDef2 Then
Exit For
End If
Next
Dim yzPlane1 As WorkPlane
Set yzPlane1 = oUCS1.YZPlane
Dim yzProxy1 As WorkPlaneProxy
Call occ1.CreateGeometryProxy(yzPlane1, yzProxy1)
Dim xzPlane1 As WorkPlane
Set xzPlane1 = oUCS1.xzPlane
Dim xzProxy1 As WorkPlaneProxy
Call occ1.CreateGeometryProxy(xzPlane1, xzProxy1)
Dim xyPlane1 As WorkPlane
Set xyPlane1 = oUCS1.xyPlane
Dim xyProxy1 As WorkPlaneProxy
Call occ1.CreateGeometryProxy(xyPlane1, xyProxy1)
Dim yzPlane2 As WorkPlane
Set yzPlane2 = oUCS2.YZPlane
Dim yzProxy2 As WorkPlaneProxy
Call occ2.CreateGeometryProxy(yzPlane2, yzProxy2)
Dim xzPlane2 As WorkPlane
Set xzPlane2 = oUCS2.xzPlane
Dim xzProxy2 As WorkPlaneProxy
Call occ2.CreateGeometryProxy(xzPlane2, xzProxy2)
Dim xyPlane2 As WorkPlane
Set xyPlane2 = oUCS2.xyPlane
Dim xyProxy2 As WorkPlaneProxy
Call occ2.CreateGeometryProxy(xyPlane2, xyProxy2)
Call oDef.Constraints.AddFlushConstraint(yzProxy1, yzProxy2, 0)
Call oDef.Constraints.AddFlushConstraint(xzProxy1, xzProxy2, 0)
Call oDef.Constraints.AddFlushConstraint(xyProxy1, xyProxy2, 0)
End Sub
Please feel free to contact if there is any queries,
If solves problem, click on "Accept as solution" / give a "kudo".
Thanks and regards,
CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network