Use AddUcsToUcs constraint in C#

Use AddUcsToUcs constraint in C#

sanjeevwagle
Explorer Explorer
413 Views
1 Reply
Message 1 of 2

Use AddUcsToUcs constraint in C#

sanjeevwagle
Explorer
Explorer

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

0 Likes
414 Views
1 Reply
Reply (1)
Message 2 of 2

chandra.shekar.g
Autodesk Support
Autodesk Support

@sanjeevwagle,

 

AddUcsToUcs method is available in Autodesk.iLogic.Interfaces.dll.(Inventor 2019 API). The dll is available at installed path of Inventor 2019 (In my system, it is available at "C:\Program Files\Autodesk\Inventor 2019\Bin" location).For more details, refer below help documentation link.

 

https://help.autodesk.com/cloudhelp/2019/KOR/Inventor-iLogic/iLogic_API/html/e5189a51-4c90-4826-c10d...

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes