This document is archived and information here might be outdated.  Recommended version.


ISnappingWindow Interface (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference (Editor)  

ISnappingWindow Interface

Provides access to methods for working with the snapping window.

Product Availability

Available with ArcGIS Desktop.

When To Use

Use the ISnappingWindow interface after programmatically changing the snapping environment to refresh the contents of the Snapping Window. You can also programmatically close or open the snapping window using the Hide and Show methods.

Members

Description
Method Hide Hides the window.
Method RefreshContents Refreshes the contents.
Method Show Shows the window.

Remarks

The snapping window reveals all of the snap agents registered in the snap agent component category. Custom snap agents appear in the bottom half of the snapping window.

The first time the snapping window is opened, a feature snap agent is created for each editable featureclass. Each feature snap agent initially has its HitType property set to esriGeometryPartNone. Change the HitType by checking the appropriate box in the snapping window or programmatically change it using IFeatureSnapAgent::HitType.

Snap agents other than feature snap agents, Snap Perpendicular for example, are not instantiated the first time the snapping window is opened. Instead, these snap agents are created only when they are checked off in the snapping window or instantiated programmatically.

Call RefreshContents to update the snapping window with any programmatic changes made to the snapping environment.

To get a handle to the snapping window use IEditor::FindExtension.

[C#]

The following example shows a stand-alone subroutine that clears all the snap agents in C#.

public void ClearSnap()
{
  //You can get app from ICommand :: OnCreate() hook parameter
  UID editorUid=new UIDClass();
  editorUid.Value="esriEditor.Editor";
  IEditor editor=app.FindExtensionByCLSID(editorUid) as IEditor;
  ISnapEnvironment snapEnv=editor as ISnapEnvironment;
  //Clear all of the loaded snap agents
  snapEnv.ClearSnapAgents();

  UID extUid=new UIDClass();
  extUid.Value="esriEditor.SnappingWindow";

  //Get a handle to the snapping window from the editor
  ISnappingWindow snapWindow=editor.FindExtension(extUid) as ISnappingWindow;
  snapWindow.RefreshContents();
}


 

[Visual Basic .NET]

The following example shows a stand-alone subroutine that clears all the snap agents in VBNet.

  Public Sub ClearSnap()
    'You can get app from ICommand :: OnCreate() hook parameter
    Dim editorUid As UID=New UIDClass()
    editorUid.Value="esriEditor.Editor"
    Dim editor As IEditor=TryCast(app.FindExtensionByCLSID(editorUid), IEditor)
    Dim snapEnv As ISnapEnvironment=TryCast(editor, ISnapEnvironment)
    'Clear all of the loaded snap agents
    snapEnv.ClearSnapAgents()

    Dim extUid As UID=New UIDClass()
    extUid.Value="esriEditor.SnappingWindow"

    'Get a handle to the snapping window from the editor
    Dim snapWindow As ISnappingWindow=TryCast(editor.FindExtension(extUid), ISnappingWindow)
    snapWindow.RefreshContents()
  End Sub

See Also

ISnapEnvironment Interface

.NET Related Topics

Working with the editor snap environment