This content has been marked as final. Show 2 replies
I want to create macro that extract the xyz coordinates in the assembly file of points were drawn in a part file
In an assembly file I have two copies of the same part. The part contains a sketch with 10 points. I want to get the coordinate of the two sets of points in the assembly file.
When I click on an individual point, I get the coordinate of it in the assembly file But when I use the script below I get the coordinate of the points in the part file.
I tried to create a sketch in the assembly file and project geometry by just selecting the sketch in the part file that contains the 10 points. It didn't work just by selecting the sketch in the feature manager design tree. But it works if I select the point by clicking on them.
Is there a way to get the coordinates relative to the assembly file not the part file.
Set swSketch = swModel.GetActiveSketch2
sketchPointArray = swSketch.GetSketchPoints2
pointCount = UBound(sketchPointArray) + 1
For i = 0 To (pointCount - 1)
Debug.Print "Sketch point x, y and z coordinates: " & sketchPointArray(i).X; " and " & sketchPointArray(i).Y; "and " & sketchPointArray(i).Z
Debug.Print " "