Hello everyone,
I have a while loop that im using to prompt the user to select a face so that a sketch may be started on it.
everything works fine (Im able to spin the model around and make selections) when testing it in the vb editor but when I run it from within soldiworks using the "Run Macro" button I cannot spin the model around nor make selections. essentially SW locks up and the only way out is to end the process.
is there something wrong with the loop im using or the way im connecting to solidworks?
Option Explicit
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim swSelMgr As SldWorks.SelectionMgr
Const SelectedObjectCount = 1
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
'Select the face to verify macro is workiing
boolstatus = Part.Extension.SelectByID2("", "FACE", 0.304800000000057, 0.151591133586805, -3.67656190501293E-02, False, 0, Nothing, 0)
'Selection Setup
Set swSelMgr = Part.SelectionManager
Part.ClearSelection2 True
MsgBox "Select a Face to to start a sketch on, then click OK."
'frmSelectFace.Show
'Wait while user selects a face and clicks OK
While swSelMgr.GetSelectedObjectCount < SelectedObjectCount
Wend
End Sub
thank you in advance for the help
Chris