
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I want to add parts to an assembly and align them with the assembly ucs. The parts have a ucs placed on the with the correct orientation. The idea is to have all the parts in an assembly with the correct side up and aligned the correct way for router cutting.
Below is the code I have tried without success. Any help would be appreciated.
Dim oAssm As Inventor.AssemblyDocument
Dim oOcc As Inventor.ComponentOccurrence
Dim oMatrix As Inventor.Matrix
' Open an assembly template
oAssm = ThisApplication.Documents.Open(oTDir.TemplateDir & "Standard.iam")
' Add the part to the assembly
oOcc = oAssm.ComponentDefinition.Occurrences.Add(ReturnFieldValue(GlobalRouterList.Item(I), 1), oMatrix)
Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
' Define the origin point.
Dim oPartOrigin As Point = Nothing
Dim oAssmOrigin As Point = Nothing
' Define the axis vectors.
Dim oPartXAxis As Vector = Nothing
Dim oPartYAxis As Vector = Nothing
Dim oPartZAxis As Vector = Nothing
Dim oAssmXAxis As Vector = Nothing
Dim oAssmYAxis As Vector = Nothing
Dim oAssmZAxis As Vector = Nothing
' Create the matrix and define the desired coordinate system.
Dim oAssmMatrix As Inventor.Matrix = oTG.CreateMatrix
Call oAssmMatrix.GetCoordinateSystem(oAssmOrigin, oAssmXAxis, oAssmYAxis, oAssmZAxis)
Call oMatrix.GetCoordinateSystem(oPartOrigin, oPartXAxis, oPartYAxis, oPartZAxis)
Call oMatrix.SetToAlignCoordinateSystems(oPartOrigin, oPartXAxis, oPartYAxis, oPartZAxis, oAssmOrigin, oAssmXAxis, oAssmYAxis, oAssmZAxis)
oAssm.Update()
Malcolm
Solved! Go to Solution.