How to clear snap agents


This sample clears all snap agents and updates the snapping dialog window.

How to use

  1. Load one or more feature layers into an ArcMap session and Start Editing.
  2. Open the Editor's Snapping Window and enable (Check) one or more snap agents.
  3. Paste the code into VBA and run the subroutine.
[VBA]
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






Additional Requirements
  • An Edit Session.