hello @JaneFan !
I was trying to follow your example, but my Working point is deeper in assembly tree and I have to go through "reference path" to "get" the occurrence.
I'm still getting the coordinates to the local component origin...
oCompDef.Occurrences.ItemByName(TempRefChain(0))
Dim stepOcc As ComponentOccurrence = flightOcc.Definition.Occurrences.ItemByName(TempRefChain(1))
Dim endPlateOcc As ComponentOccurrence = stepOcc.Definition.Occurrences.ItemByName("stepEndplate")
Function GetRotation(oCompDef As ComponentDefinition, prefix As String, viewRepWithPrefix As String)
Dim angle As Double = 0
Dim ref As String = Right(viewRepWithPrefix, viewRepWithPrefix.Length-prefix.Length)
Dim TempRefChain() As String = ref.Split(".")
Dim flightOcc As ComponentOccurrence = oCompDef.Occurrences.ItemByName(TempRefChain(0))
Dim stepOcc As ComponentOccurrence = flightOcc.Definition.Occurrences.ItemByName(TempRefChain(1))
Dim endPlateOcc As ComponentOccurrence = stepOcc.Definition.Occurrences.ItemByName("stepEndplate")
Dim point0, point1 As WorkPoint
Dim wp As WorkPoint
For Each wp In endPlateOcc.Definition.WorkPoints
If wp.Name = "Center Point" Then
Logger.Trace(wp.Name & ": " & wp.Point.X & "|" & wp.Point.Y & "|" & wp.Point.Z)
point0 = wp
ElseIf wp.Name = "outCenterPoint" Then
Logger.Trace(wp.Name & ": " & wp.Point.X & "|" & wp.Point.Y & "|" & wp.Point.Z)
point1 = wp
End If
Next wp
Dim point0Proxy, point1Proxy As WorkPointProxy
Call endPlateOcc.CreateGeometryProxy(point0, point0Proxy)
Call endPlateOcc.CreateGeometryProxy(point1, point1Proxy)
Logger.Trace("point0Proxy: " & point0Proxy.Point.X & "|" & point0Proxy.Point.Y & "|" & point0Proxy.Point.Z)
Logger.Trace("point1Proxy: " & point1Proxy.Point.X & "|" & point1Proxy.Point.Y & "|" & point1Proxy.Point.Z)
End Function
My Proxy points return the same coordinates, as WorkPoints (and they shouldn't, as they are not the same according to main Assembly), here is an output example for my files with different values of point1 coordinates :
TRACE|creating view stepView|flight:1.step:1
TRACE|Center Point: 0|0|0
TRACE|outCenterPoint: 0|-96,515|0
TRACE|point0Proxy: 0|0|0
TRACE|point1Proxy: 0|-96,515|0
TRACE|creating view stepView|flight:1.step:9
TRACE|Center Point: 0|0|0
TRACE|outCenterPoint: 0|-96,515|0
TRACE|point0Proxy: 0|0|0
TRACE|point1Proxy: 0|-96,515|0
TRACE|creating view stepView|flight:2.step:1
TRACE|Center Point: 0|0|0
TRACE|outCenterPoint: 0|-96,515|0
TRACE|point0Proxy: 0|0|0
TRACE|point1Proxy: 0|-96,515|0
-------------------------
Tomasz Malinowski