I feel like this should be a simple question but its baffled me all afternoon. I want to check to see if a sketch is currently being edited so I can prevent a macro from running if this is the case. How would I find this out?
SolidworksApi/macros
I feel like this should be a simple question but its baffled me all afternoon. I want to check to see if a sketch is currently being edited so I can prevent a macro from running if this is the case. How would I find this out?
SolidworksApi/macros
Sub main()
Dim swSketch As SldWorks.Sketch
Set swSketch = Application.SldWorks.ActiveDoc.SketchManager.ActiveSketch
If swSketch Is Nothing Then
MsgBox "No sketch active"
Else
MsgBox "Active sketch: " & swSketch.Name
End If
End Sub
Perfect, thank you. "if Var is Nothing" is exactly what I never knew I needed.