Use AddUcsToUcs constraint in C#
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am new to inventor programming.
I have written a small iLogic code for making an assembly. In it I have used constraint.AddUcsToUcs call for constraining and it works perfect. Now I intend to translate this code to VC# program. However, I am unable to access constraint.AddUcsToUcs function.
I would appreciate inputs from the experienced forum members.
A snap of the iLogic code is attached herewith.
Thanks in advance.
Sub AddParts()
Dim asmDoc As AssemblyDocument
asmDoc = ThisApplication.ActiveDocument
Dim oAsmCompDef As Inventor.AssemblyComponentDefinition
oAsmCompDef = asmDoc.ComponentDefinition
' Set a reference to the transient geometry object.
Dim oTG As Inventor.TransientGeometry
oTG = ThisApplication.TransientGeometry
'Create a matrix.
Dim oMatrix As Inventor.Matrix
oMatrix = oTG.CreateMatrix
'place an instance of the component
Dim oOcc1 As ComponentOccurrence
oOcc1 = oAsmCompDef.Occurrences.Add("C:\Users\TEST\Documents\Inventor Samples\smw_shell.ipt", oMatrix)
oOcc1.Name = "Main Shell"
'place an instance of the component
Dim oOcc2 As ComponentOccurrence
oOcc2 = oAsmCompDef.Occurrences.Add("C:\Users\TEST\Documents\Inventor Samples\smw_dish.ipt", oMatrix)
oOcc2.Name = "Top Dish"
'place an instance Of the Component
Dim oOcc3 As ComponentOccurrence
oOcc3 = oAsmCompDef.Occurrences.Add("C:\Users\TEST\Documents\Inventor Samples\smw_dish.ipt", oMatrix)
oOcc3.Name = "Bottom Dish"
asmDoc.Update()
Call Constraints.AddUcsToUcs("UcsToUcs1", "Main Shell", "StartUCS", "Top Dish", "ItemUCS", xOffset := 0, yOffset := 0, zOffset := 0)
Call Constraints.AddUcsToUcs("UcsToUcs2", "Main Shell", "EndUCS", "Bottom Dish", "ItemUCS", xOffset := 0, yOffset := 0, zOffset := 0)
Call Constraints.AddUcsToUcs("UcsToUcs3", "Main Shell", "StartUCS", "Nozzle", "ItemUCS", xOffset := 0, yOffset := 0, zOffset := 0)
End Sub