ArcGIS Pro 3.3 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 Geometry CurrentSketch {get;}
    Public ReadOnly Property CurrentSketch As Geometry
    Example
    Listen to the sketch modified event
    // SketchModified event is fired by 
    //  - COTS construction tools (except annotation, dimension geometry types), 
    //  - Edit Vertices, Reshape, Align Features
    //  - 3rd party tools with FireSketchEvents = true
    
    
    //Subscribe the sketch modified event
    //ArcGIS.Desktop.Mapping.Events.SketchModifiedEvent.Subscribe(OnSketchModified);
    
    private void OnSketchModified(ArcGIS.Desktop.Mapping.Events.SketchModifiedEventArgs args)
    {
      // if not an undo operation
      if (!args.IsUndo)
      {
        // what was the sketch before the change?
        var prevSketch = args.PreviousSketch;
        // what is the current sketch?
        var currentSketch = args.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, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also