<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to replace sketch geometry in a MapTool in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-replace-sketch-geometry-in-a-maptool/m-p/1559107#M90168</link>
    <description>&lt;P&gt;We are creating a custom Map Tool. Two sketches should be drawn one after another.&lt;/P&gt;&lt;P&gt;- First sketch should be drawn by a user;&lt;/P&gt;&lt;P&gt;- Second sketch&amp;nbsp;should be drawn programmatically and&amp;nbsp;should start at the position of the first sketch centre&lt;/P&gt;&lt;P&gt;When user does the first sketch mouse up, we have OnToolMouseUp method. We get a sketch geometry and coordinates for the second sketch, then change the sketchType (from Rectangle to Circle) , create a circle geometry and set geometry.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Question: how to make the second sketch visible?&lt;/P&gt;&lt;P&gt;ArcGIS Pro 3.4, .NET 8&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;protected async override void OnToolMouseUp(MapViewMouseButtonEventArgs args)
{
    await QueuedTask.Run(() =&amp;gt;
    {
        FireSketchEvents = true;
        ArcGIS.Core.Geometry.Geometry currentSketchGeometry = null;
        currentSketchGeometry = this.GetCurrentSketchAsync().Result;
        if (currentSketchGeometry.PointCount &amp;lt; 5)
        {  clsShare.MessageBoxShow("Cannot proceed without rectangle selection"); }
        Coordinate2D secondSketchCentrePoint = // here the point calculated

        EllipticArcSegment segment = new ArcGIS.Core.Geometry.EllipticArcBuilderEx(secondSketchCentrePoint,1,ArcOrientation.ArcCounterClockwise).ToSegment();
        ArcGIS.Core.Geometry.Polygon polylineNewSketchGeometry = PolygonBuilderEx.CreatePolygon([segment]);

        //this.ClearSketchAsync();
        //base.OnToolMouseUp(args);
        this.SketchType = SketchGeometryType.Circle;
        this.SetCurrentSketchAsync(polylineNewSketchGeometry);
        this.StartSketchAsync();
        args.Handled = true;
    });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 15 Nov 2024 11:21:06 GMT</pubDate>
    <dc:creator>MarkMindlin_idea</dc:creator>
    <dc:date>2024-11-15T11:21:06Z</dc:date>
    <item>
      <title>How to replace sketch geometry in a MapTool</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-replace-sketch-geometry-in-a-maptool/m-p/1559107#M90168</link>
      <description>&lt;P&gt;We are creating a custom Map Tool. Two sketches should be drawn one after another.&lt;/P&gt;&lt;P&gt;- First sketch should be drawn by a user;&lt;/P&gt;&lt;P&gt;- Second sketch&amp;nbsp;should be drawn programmatically and&amp;nbsp;should start at the position of the first sketch centre&lt;/P&gt;&lt;P&gt;When user does the first sketch mouse up, we have OnToolMouseUp method. We get a sketch geometry and coordinates for the second sketch, then change the sketchType (from Rectangle to Circle) , create a circle geometry and set geometry.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Question: how to make the second sketch visible?&lt;/P&gt;&lt;P&gt;ArcGIS Pro 3.4, .NET 8&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;protected async override void OnToolMouseUp(MapViewMouseButtonEventArgs args)
{
    await QueuedTask.Run(() =&amp;gt;
    {
        FireSketchEvents = true;
        ArcGIS.Core.Geometry.Geometry currentSketchGeometry = null;
        currentSketchGeometry = this.GetCurrentSketchAsync().Result;
        if (currentSketchGeometry.PointCount &amp;lt; 5)
        {  clsShare.MessageBoxShow("Cannot proceed without rectangle selection"); }
        Coordinate2D secondSketchCentrePoint = // here the point calculated

        EllipticArcSegment segment = new ArcGIS.Core.Geometry.EllipticArcBuilderEx(secondSketchCentrePoint,1,ArcOrientation.ArcCounterClockwise).ToSegment();
        ArcGIS.Core.Geometry.Polygon polylineNewSketchGeometry = PolygonBuilderEx.CreatePolygon([segment]);

        //this.ClearSketchAsync();
        //base.OnToolMouseUp(args);
        this.SketchType = SketchGeometryType.Circle;
        this.SetCurrentSketchAsync(polylineNewSketchGeometry);
        this.StartSketchAsync();
        args.Handled = true;
    });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 11:21:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-replace-sketch-geometry-in-a-maptool/m-p/1559107#M90168</guid>
      <dc:creator>MarkMindlin_idea</dc:creator>
      <dc:date>2024-11-15T11:21:06Z</dc:date>
    </item>
  </channel>
</rss>

