Intersection Snap Agent


The Intersection Snap Agent sample illustrates how to create a custom snap agent using Visual Basic. This snap agent snaps to the intersections of polylines which can be helpful when precisely splitting polyline features at intersections.

How to use:
  1. Register the dll on your machine.
  2. Using Categories, register IntersectionSnap in the 'ESRI Snap Agents' component category.
  3. Start an edit session with at least one polyline layer loaded.
  4. Open the snapping dialog and the custom snap agent 'Intersection Snap' should appear in the bottom half of the window. Click it on.
  5. Select a polyline feature that overlaps other polylines in the layer.
  6. Select the editor's sketch tool and notice its new snapping behavior.


Requires: An edit session with a polyline layer.

Difficulty: Intermediate

Visual Basic
File Description
IntersectSnap.cls Class file demonstrating how to create a snap agent.
IntersectionSnap.vbp The project file for the sample snap agent.
IntersectionSnap.dll The compiled project.

Key CoClasses: GeometryBag, SnapAgent
Key Interfaces: IGeometryCollection, IProximityOperator, ISnapAgent, ITopologicalOperator
Key Members: IGeometryCollection::AddGeometry, IProximityOperator::QueryNearestPoint, IProximityOperator::ReturnDistance, ISnapAgent::Snap, ITopologicalOperator::ConstructUnion, ITopologicalOperator::Intersect