How to get Model sketch points coords in Drawings?

Hi there!
I would like to get the points of a model sketch in drawing coordinates. I wrote a small script, but it gives me the coordinates of points that do not correspond to the coordinates of the drawing.
Can someone help me how to solve this issue?
My macro code:
' *****************
Option Explicit
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swDraw As SldWorks.DrawingDoc
Dim swView As SldWorks.View
Dim Part As Object
Dim swSelMgr As SldWorks.SelectionMgr
Dim swSketch As SldWorks.Sketch
Dim swFeat As SldWorks.Feature
Dim swSketchPoint As SldWorks.SketchPoint
Dim sketchPointArray As Variant
Dim vSketchPtID As Variant
Dim vSketchPt As Variant
Dim swSelData As SldWorks.SelectData
Dim i As Long
Dim xValue As Double
Dim yValue As Double
Dim boolstatus As Boolean

Set swApp = CreateObject("SldWorks.Application")

Set Part = swApp.ActiveDoc
Set swDraw = Part
Set swSelMgr = Part.SelectionManager

Set swView = swDraw.GetFirstView 'Page
Set swView = swView.GetNextView '1st Drawing View

boolstatus = Part.Extension.SelectByID2("Sketch1@Part1-2@Drawing View1", "SKETCH", 0, 0, 0, False, 0, Nothing, 0)

Set swFeat = swSelMgr.GetSelectedObject6(1, -1)
Set swSketch = swFeat.GetSpecificFeature2

sketchPointArray = swSketch.GetSketchPoints2
For i = 0 To UBound(sketchPointArray)
'Value returned by ISketchPoint::GetCoords
Set swSketchPoint = sketchPointArray(i)
'x & y coordinates
xValue = sketchPointArray(i).X
yValue = sketchPointArray(i).Y

'Point ID
boolstatus = swSketchPoint.Select4(True, swSelData)
vSketchPtID = swSketchPoint.GetID
Debug.Print " Sketch point ID (" & i & ") = [" & vSketchPtID(1) & "]"
Debug.Print " Sketch point ID (" & i & ") = [" & vSketchPtID(0) & ", " & vSketchPtID(1) & "]"

Debug.Print "Point coordinates: "
Debug.Print " x: " & xValue *
1000
Debug.Print " y: " & yValue * 1000

Debug.Print " "
' Do something useful with the data
Next i
Part.ClearSelection2 True

End Sub
' *
****************
Reply to
Alexander Mikhalchuk
Loading thread data ...
In the drawing, there are 2 co-ordinate system - sheet and view. Which system do you want them in. Also can you furnish little more details of what you are doing?
Reply to
Nirantar Vidyarthee

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.