ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping.Events Namespace / SketchModifiedEventArgs Class / CurrentSketch Property
Example

In This Topic
    CurrentSketch Property
    In This Topic
    Gets the current sketch geometry.
    Syntax
    Public ReadOnly Property CurrentSketch As Geometry
    public Geometry CurrentSketch {get;}
    Example
    Listen to the sketch modified event
    // Occurs when a sketch is modified. SketchModified event is fired by 
    //  - COTS construction tools (except annotation, dimension geometry types), 
    //  - Edit Vertices, Reshape, Align Features
    //  - 3rd party tools with FireSketchEvents = true
    // Handles the SketchModified event, providing access to the current and previous sketch geometries when a sketch
    // is modified.
    // Register for the SketchModified event
    SketchModifiedEvent.Subscribe(sketchModifiedEventArgs
      =>
    {
      // if not an undo operation
      if (!sketchModifiedEventArgs.IsUndo)
      {
        // what was the sketch before the change?
        var prevSketch = sketchModifiedEventArgs.PreviousSketch;
        // what is the current sketch?
        var currentSketch = sketchModifiedEventArgs.CurrentSketch;
        if (currentSketch is Polyline polyline)
        {
          // Examine the current (last) vertex in the line sketch
          var lastSketchPoint = polyline.Points.Last();
          // do something with the last point
        }
      }
    });
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also