// BeforeSketchCompleted event is fired by // - COTS construction tools (except annotation, dimension geometry types), // - Edit Vertices, Reshape, Align Features // - 3rd party tools with FireSketchEvents = true //Subscribe to the before sketch completed event //ArcGIS.Desktop.Mapping.Events.BeforeSketchCompletedEvent.Subscribe(OnBeforeSketchCompleted); private Task OnBeforeSketchCompleted(BeforeSketchCompletedEventArgs args) { //assign sketch Z values from default surface and set the sketch geometry var modifiedSketch = args.MapView.Map.GetZsFromSurfaceAsync(args.Sketch).Result; args.SetSketchGeometry(modifiedSketch.Geometry); return Task.CompletedTask; }
Target Platforms: Windows 11, Windows 10