Is it possible to identify the location of a part in an assembly file?
I cannot access (or find access to) global locations, just local. You may ask, whats the problem? Well, right now, I have 10 subAssemblies and they are all "located" at (0,0,0), which means I have 10 solids sharing the exact same space. This problem can be easily fixed if I can compare the Global Origin to a Local Origin, but I can only find the "work axes origin" which is worthless to me.
Any assistence/material would be appriciated.
Thank you,
-lemensk
Solved! Go to Solution.
Solved by lemensk. Go to Solution.
Location and orientation of the component in the assembly coordinate system is controlled by component’s matrix object.
Could you please look at this thread
Below is the answer to my question. Surprised how hard it was to get such simple code:
'CODE START ---------------------------------
Sub printParts()
Dim inventDoc As Inventor.AssemblyDocument
Dim deltaX, deltaY, deltaZ, avgX, avgY, avgZ, minX, minY, minZ, maxX, maxY, maxZ As Double
Dim fileName, strg As String
Dim partOccur As Inventor.ComponentOccurrence
Set inventDoc = ThisApplication.ActiveDocument
fileName = inventDoc.DisplayName
For Each partOccur In inventDoc.ComponentDefinition.Occurrences.AllLeafOccurrences 'For each part included in the assembly
strg = partOccur.Name & ";" & partOccur.RangeBox.minPoint.X & ";" & partOccur.RangeBox.minPoint.Y & _
";" & partOccur.RangeBox.minPoint.Z
Open "C:\Temp\" & fileName & ".txt" For Append As #1 'Open txt file and Append
Print #1, strg 'Print String
Close #1 'Close txt file
Next
End Sub
'CODE STOP ---------------------------------