Please advise how can one write the X & Y cordinates of asketch point as custom properties.(see code below) I would likecustom properties of the X & Y cordinates to be shown on thedrawing of the part.Is it possible to values to be shown asfollows:
Start Point
X - xxxx (X co-ordinate)
Y - xxxx ( Y co-ordinate)
Also, is it possible to write the X & Y co-ordinates of morethan one point as custom properties/
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim Part As ModelDoc2
Dim Measure As Measure
Dim boolstatus As Boolean
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set Measure = Part.Extension.CreateMeasure
Dim strDisplay As String
boolstatus = Measure.Calculate(Nothing)
If (boolstatus) Then
If (Not (Measure.X = -1)) Then
Debug.Print "X coordinate: " & Measure.X
End If
If (Not (Measure.Y = -1)) Then
Debug.Print "Y coordinate: " & Measure.Y
End If
If (Not (Measure.DeltaX = -1)) Then
Debug.Print "DeltaX: " & Measure.DeltaX
End If
If (Not (Measure.DeltaY = -1)) Then
Debug.Print "DeltaY: " & Measure.DeltaY
End If
End Sub
SolidworksApi macros
Start Point
X - xxxx (X co-ordinate)
Y - xxxx ( Y co-ordinate)
Also, is it possible to write the X & Y co-ordinates of morethan one point as custom properties/
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim Part As ModelDoc2
Dim Measure As Measure
Dim boolstatus As Boolean
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
Set Measure = Part.Extension.CreateMeasure
Dim strDisplay As String
boolstatus = Measure.Calculate(Nothing)
If (boolstatus) Then
If (Not (Measure.X = -1)) Then
Debug.Print "X coordinate: " & Measure.X
End If
If (Not (Measure.Y = -1)) Then
Debug.Print "Y coordinate: " & Measure.Y
End If
If (Not (Measure.DeltaX = -1)) Then
Debug.Print "DeltaX: " & Measure.DeltaX
End If
If (Not (Measure.DeltaY = -1)) Then
Debug.Print "DeltaY: " & Measure.DeltaY
End If
End Sub
SolidworksApi macros