This sample clears all snap agents and updates the snapping dialog window.
How to use
- Load one or more feature layers into an ArcMap session and Start Editing.
- Open the Editor's Snapping Window and enable (Check) one or more snap agents.
- Paste the code into VBA and run the subroutine.
Sub ClearSnapAgents()
Dim pApp As IApplication
Dim pEditor As IEditor
Dim pID As New UID
Dim pSnapUID As New UID
Dim pSnapEnv As ISnapEnvironment
Dim pSnapWindow As ISnappingWindow
Set pApp = Application
pID = "esriEditor.Editor"
Set pEditor = pApp.FindExtensionByCLSID(pID)
pSnapUID = "esriEditor.SnappingWindow"
Set pSnapEnv = pEditor
'Clear all of the loaded snap agents
pSnapEnv.ClearSnapAgents
'Get a handle to the snapping window from the editor
Set pSnapWindow = pEditor.FindExtension(pSnapUID)
pSnapWindow.RefreshContents
End Sub