Coordinates of point - macro
Coordinates of point - macro
(OP)
Hello.I'm working with SolidWorks API not so long.I try make, then find macro which allow get coordintes of point (for example of surface). I don't want vertex and edge point because this I know how get. I want get coordinates any point of surface... If You have any odeas and have time to help me I willbe greatful...






RE: Coordinates of point - macro
RE: Coordinates of point - macro
RE: Coordinates of point - macro
CODE
Dim swApp As SldWorks.SldWorks
Dim swDoc As SldWorks.ModelDoc2
Dim SelMgr As SldWorks.SelectionMgr
Dim NumSelects As Long
Dim SelectedObj As Object
Dim PickPoint As Variant
Dim StickPoint As Variant
Dim sMsg As String
Dim UnitFactor As Double
UnitFactor = 1000 'Get from m to mm
Set swApp = Application.SldWorks
Set swDoc = swApp.ActiveDoc
Set SelMgr = swDoc.SelectionManager
NumSelects = SelMgr.GetSelectedObjectCount
If NumSelects = 0 Then
MsgBox "Pick a surface and run macro again"
Exit Sub
End If
Set SelectedObj = SelMgr.GetSelectedObject(NumSelects)
PickPoint = SelMgr.GetSelectionPoint2(NumSelects, -1)
If SelMgr.GetSelectedObjectType3(NumSelects, -1) = 2 Then
sMsg = "X: " & Str(PickPoint(0) * UnitFactor) & vbCrLf & _
"Y: " & Str(PickPoint(1) * UnitFactor) & vbCrLf & _
"Z: " & Str(PickPoint(2) * UnitFactor)
MsgBox sMsg
Else
MsgBox "You must select a surface"
End If
Set SelectedObj = Nothing
Set SelMgr = Nothing
Set swDoc = Nothing
Set swApp = Nothing
End Sub