
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a Problem and need help.
I want to get the coordinates of an workpoint in a UserCoordinateSystem (UCS).
I thought i can get it with the function „TransformBy“
point.TransformBy(UCS.Transformation)
But for the example in the screenshot i get the result: X: 0, Y: 2, Z: 0 … but it should be X: 0, Y: 0, Z: 0
Here a example-Code:
Public Sub test()
Dim p As PartDocument
Dim oTG As TransientGeometry
Dim u As UserCoordinateSystem
Dim wp As WorkPoint
Dim point As point
Dim v As Vector
Set p = ThisDocument
Set oTG = ThisApplication.TransientGeometry
Set u = p.ComponentDefinition.UserCoordinateSystems.Item(1)
For Each wp In p.ComponentDefinition.WorkPoints
Debug.Print wp.Name
If (InStr(1, wp.Name, "Point", vbTextCompare)) Then
Debug.Print "Orig x: " & wp.point.X & ", y: " & wp.point.Y & ", z: " & wp.point.Z
Set point = wp.point.Copy()
Call point.TransformBy(u.Transformation)
Debug.Print "Transform x: " & point.X & ", y: " & point.Y & ", z: " & point.Z
End If
Next
End Sub
Solved! Go to Solution.