<?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 Re: EditOperation not getting added to undo stack in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/editoperation-not-getting-added-to-undo-stack/m-p/1196732#M8510</link>
    <description>&lt;P&gt;I think I've got it figured.&amp;nbsp; I had to re-arrange the code a bit.&amp;nbsp; After duplicating each selected feature, I was doing a .Move (to clicked location).&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;//edit operation
                var edOp = new EditOperation();
                //edOp.ExecuteMode = ExecuteModeType.Sequential;
                edOp.Name = "Copy Features Tool";
                edOp.EditOperationType = EditOperationType.Long;
                edOp.SelectModifiedFeatures = false;
foreach (var item in allSelectionSetValues.First())
                {
                    var specificValue = item;
                    var gadgetInsp = new Inspector();
                    gadgetInsp.Load(layer, specificValue);
                    var geom = gadgetInsp["SHAPE"] as Geometry;

                    geomList.Add(geom);

                    var rtoken = edOp.Create(gadgetInsp.MapMember, gadgetInsp.ToDictionary(a =&amp;gt; a.FieldName, a =&amp;gt; a.CurrentValue)); 
                    rowTokens.Add(rtoken);
                }
                edOp.Execute();&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 28 Jul 2022 13:35:51 GMT</pubDate>
    <dc:creator>BrettWaddingham</dc:creator>
    <dc:date>2022-07-28T13:35:51Z</dc:date>
    <item>
      <title>EditOperation not getting added to undo stack</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/editoperation-not-getting-added-to-undo-stack/m-p/1196333#M8495</link>
      <description>&lt;P&gt;I'm creating a tool in ArcGIS Pro 3.0 that will duplicate selected features to a point that is clicked on the map.&amp;nbsp; The process works fine, but does not get added to the undo stack.&lt;/P&gt;&lt;P&gt;For example, I create 3 line features, selected all 3 features, Use my tool (click on map, those 3 features are duplicated with their combined center being on the point that I clicked).&lt;/P&gt;&lt;P&gt;If I were to click 'undo', this undoes my duplicate AND the last line I had created (leaving me as though I'd only created 2 lines).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2022 14:23:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/editoperation-not-getting-added-to-undo-stack/m-p/1196333#M8495</guid>
      <dc:creator>BrettWaddingham</dc:creator>
      <dc:date>2022-07-27T14:23:40Z</dc:date>
    </item>
    <item>
      <title>Re: EditOperation not getting added to undo stack</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/editoperation-not-getting-added-to-undo-stack/m-p/1196426#M8498</link>
      <description>&lt;P&gt;Hi Brett,&lt;/P&gt;&lt;P&gt;Just to confirm- you're using the EditOperation class to duplicate the features, right? &amp;nbsp;Could you send us the EditOperation code that you use in your tool? &amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;--Rich&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2022 16:25:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/editoperation-not-getting-added-to-undo-stack/m-p/1196426#M8498</guid>
      <dc:creator>RichRuh</dc:creator>
      <dc:date>2022-07-27T16:25:27Z</dc:date>
    </item>
    <item>
      <title>Re: EditOperation not getting added to undo stack</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/editoperation-not-getting-added-to-undo-stack/m-p/1196450#M8499</link>
      <description>&lt;LI-CODE lang="csharp"&gt;                //edit operation
                var edOp = new EditOperation();
                //edOp.ExecuteMode = ExecuteModeType.Sequential;
                edOp.Name = "Copy Features Tool";
                edOp.EditOperationType = EditOperationType.Long;
                edOp.SelectModifiedFeatures = false;
                edOp.Execute();

                //For each feature in selectedFeatures, get the specific OID for that feature
                //then, add it to the oIDs list
                foreach (var item in allSelectionSetValues.First())
                {
                    var specificValue = item;

                    var duplicateFeatures = edOp.CreateChainedOperation();
                    duplicateFeatures.Name = "Duplicate Features";

                    var gadgetInsp = new Inspector();
                    gadgetInsp.Load(layer, specificValue);
                    var geom = gadgetInsp["SHAPE"] as Geometry;
                    
                    geomList.Add(geom);

                    var rtoken = duplicateFeatures.Create(gadgetInsp.MapMember, gadgetInsp.ToDictionary(a =&amp;gt; a.FieldName, a =&amp;gt; a.CurrentValue));
                    if (duplicateFeatures.Execute())
                    {
                        oIDs.Add((long)rtoken.ObjectID);
                    }
                }&lt;/LI-CODE&gt;&lt;P&gt;Here is the portion of code that has to do with the edit operation after the mouse is clicked.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2022 17:07:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/editoperation-not-getting-added-to-undo-stack/m-p/1196450#M8499</guid>
      <dc:creator>BrettWaddingham</dc:creator>
      <dc:date>2022-07-27T17:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: EditOperation not getting added to undo stack</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/editoperation-not-getting-added-to-undo-stack/m-p/1196467#M8500</link>
      <description>&lt;P&gt;Chained edit operations are typically used when the results of one call to Execute are needed for a subsequent call. &amp;nbsp;Maybe I'm missing something, but that doesn't seem to be the case here.&lt;/P&gt;&lt;P&gt;Could you try restructuring the code like this:&lt;/P&gt;&lt;PRE&gt;Create an edit operation&lt;BR /&gt;For each feature in the selection set&lt;BR /&gt;  Create a copy, and call editOp.Create&lt;BR /&gt;Call editOp.Execute once at the end&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Jul 2022 17:41:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/editoperation-not-getting-added-to-undo-stack/m-p/1196467#M8500</guid>
      <dc:creator>RichRuh</dc:creator>
      <dc:date>2022-07-27T17:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: EditOperation not getting added to undo stack</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/editoperation-not-getting-added-to-undo-stack/m-p/1196506#M8502</link>
      <description>&lt;P&gt;Check the return value of edOp.Execute(); It might be false.&amp;nbsp; Also check if edOp.IsEmpty is set.&amp;nbsp; But yes I agree with Rich i don't see the need for a chained operation here either.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2022 18:44:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/editoperation-not-getting-added-to-undo-stack/m-p/1196506#M8502</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2022-07-27T18:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: EditOperation not getting added to undo stack</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/editoperation-not-getting-added-to-undo-stack/m-p/1196732#M8510</link>
      <description>&lt;P&gt;I think I've got it figured.&amp;nbsp; I had to re-arrange the code a bit.&amp;nbsp; After duplicating each selected feature, I was doing a .Move (to clicked location).&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;//edit operation
                var edOp = new EditOperation();
                //edOp.ExecuteMode = ExecuteModeType.Sequential;
                edOp.Name = "Copy Features Tool";
                edOp.EditOperationType = EditOperationType.Long;
                edOp.SelectModifiedFeatures = false;
foreach (var item in allSelectionSetValues.First())
                {
                    var specificValue = item;
                    var gadgetInsp = new Inspector();
                    gadgetInsp.Load(layer, specificValue);
                    var geom = gadgetInsp["SHAPE"] as Geometry;

                    geomList.Add(geom);

                    var rtoken = edOp.Create(gadgetInsp.MapMember, gadgetInsp.ToDictionary(a =&amp;gt; a.FieldName, a =&amp;gt; a.CurrentValue)); 
                    rowTokens.Add(rtoken);
                }
                edOp.Execute();&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 28 Jul 2022 13:35:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/editoperation-not-getting-added-to-undo-stack/m-p/1196732#M8510</guid>
      <dc:creator>BrettWaddingham</dc:creator>
      <dc:date>2022-07-28T13:35:51Z</dc:date>
    </item>
  </channel>
</rss>

