Hello All,
I am new to the solidworks API. I do most of my programming in Excel VBA so I'm trying to figure out the solidworks object model. I need to get the x, y, z coordinates of a sketch point based on the name of the sketch and the point. I have recorded some macros but I just get statements like the one below.
boolstatus = Part.Extension.SelectByID2("Point2", "SKETCHPOINT", 0.02257855154992, 0.05167601790474, 0, False, 0, Nothing, 0)
This only tells me whether the selection of the point was successful. It won't tell me the point coordinates.
Below is some pseudo code that will show what I'm trying to do. I want to find the coorinates of Point1 in Sketch1.
Sub GetPointCoords()
Dim swApp As Object, Part As Object, skPoint As Object
Dim dX As Double, dY As Double, dZ As Double
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set skPoint = Part.Sketch("Sketch1").SketchPoint("Point1")
dX = skPoint.X
dY = skPoint.Y
dZ = skPoint.Z
End Sub
Any help would be greatly appreciated.
Thanks
Kyle
SolidworksApi macros