Files
Move mouse cursor to selected point
Code
'Written by Keith Rice
'CADSharp LLC
'www.cadsharp.com
'Written in SolidWorks 2011
'Demonstrates how to move mouse cursor to a particular location in model view space; _
in this case, the location where the user previously selected an entity in the _
display area.
'Preconditions: Part or assy is open and entity is selected.
'Postconditions: After clicking OK in the message box, user's cursor is returned to the _
selection point.
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swMouse As SldWorks.Mouse
Dim swSelMgr As SldWorks.SelectionMgr
Dim swModelView As SldWorks.ModelView
Dim vSelPoints As Variant
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swModelView = swModel.GetFirstModelView
Set swMouse = swModelView.GetMouse
Set swSelMgr = swModel.SelectionManager
vSelPoints = swSelMgr.GetSelectionPoint2(1, -1)
swMouse.MoveXYZ vSelPoints(0), vSelPoints(1), vSelPoints(2), swMouse_MouseMove
End Sub