<?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: Remove all construction tools in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-all-construction-tools/m-p/1536976#M12072</link>
    <description>Hello,&lt;BR /&gt;I am using ArcGIS.Desktop.Mapping but it says GetTemplates does not exist and MappingExtensions also does not exist in ArcGIS.Desktop.Mapping&lt;BR /&gt;</description>
    <pubDate>Tue, 10 Sep 2024 17:54:30 GMT</pubDate>
    <dc:creator>JonathanDewalt</dc:creator>
    <dc:date>2024-09-10T17:54:30Z</dc:date>
    <item>
      <title>Remove all construction tools</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-all-construction-tools/m-p/1536884#M12070</link>
      <description>&lt;P&gt;Has anybody got this sample to work? I want to be able to remove all construction tools and only use the my custom tools but I can't seem to find a way to remove the default tools without having to manually enter the ID for each and everytool.&amp;nbsp; This example off ESRI web page shows featLayer.GetTemplates but the GetTemplates function does not exist.&lt;/P&gt;&lt;PRE&gt;QueuedTask.Run(() =&amp;gt;
{
  &lt;SPAN&gt;//hide all tools except line tool on layer&lt;/SPAN&gt;  &lt;SPAN&gt;var&lt;/SPAN&gt; featLayer = MapView.Active.Map.FindLayers(&lt;SPAN&gt;"Roads"&lt;/SPAN&gt;).First();

  &lt;SPAN&gt;var&lt;/SPAN&gt; editTemplates = featLayer.GetTemplates();
  &lt;SPAN&gt;var&lt;/SPAN&gt; newCIMEditingTemplates = &lt;SPAN&gt;new&lt;/SPAN&gt; List&amp;lt;CIMEditingTemplate&amp;gt;();

  &lt;SPAN&gt;foreach&lt;/SPAN&gt; (&lt;SPAN&gt;var&lt;/SPAN&gt; et &lt;SPAN&gt;in&lt;/SPAN&gt; editTemplates)
  {
    &lt;SPAN&gt;//initialize template by activating default tool&lt;/SPAN&gt;    et.ActivateDefaultToolAsync();
    &lt;SPAN&gt;var&lt;/SPAN&gt; cimEditTemplate = et.GetDefinition();
    &lt;SPAN&gt;//get the visible tools on this template&lt;/SPAN&gt;    &lt;SPAN&gt;var&lt;/SPAN&gt; allTools = et.ToolIDs.ToList();
    &lt;SPAN&gt;//add the hidden tools on this template&lt;/SPAN&gt;    allTools.AddRange(cimEditTemplate.GetExcludedToolIDs().ToList());
    &lt;SPAN&gt;//hide all the tools then allow the line tool&lt;/SPAN&gt;  
    &lt;SPAN&gt;//At 2.x -
    //allTools.AddRange(cimEditTemplate.GetExcludedToolDamlIds().ToList());&lt;/SPAN&gt;    allTools.AddRange(cimEditTemplate.GetExcludedToolIDs().ToList());
    
    &lt;SPAN&gt;//At 2.x - 
    //cimEditTemplate.SetExcludedToolDamlIds(allTools.ToArray());
    //cimEditTemplate.AllowToolDamlID("esri_editing_SketchLineTool");&lt;/SPAN&gt;    
    cimEditTemplate.SetExcludedToolIDs(allTools.ToArray());
    cimEditTemplate.AllowToolID(&lt;SPAN&gt;"esri_editing_SketchLineTool"&lt;/SPAN&gt;);
    newCIMEditingTemplates.Add(cimEditTemplate);
  }
  &lt;SPAN&gt;//update the layer templates&lt;/SPAN&gt;  &lt;SPAN&gt;var&lt;/SPAN&gt; layerDef = featLayer.GetDefinition() &lt;SPAN&gt;as&lt;/SPAN&gt; CIMFeatureLayer;
  &lt;SPAN&gt;// Set AutoGenerateFeatureTemplates to false for template changes to stick&lt;/SPAN&gt;  layerDef.AutoGenerateFeatureTemplates = &lt;SPAN&gt;false&lt;/SPAN&gt;;
  layerDef.FeatureTemplates = newCIMEditingTemplates.ToArray();
  featLayer.SetDefinition(layerDef);
});&lt;/PRE&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2024 15:27:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-all-construction-tools/m-p/1536884#M12070</guid>
      <dc:creator>JonathanDewalt</dc:creator>
      <dc:date>2024-09-10T15:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: Remove all construction tools</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-all-construction-tools/m-p/1536955#M12071</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic9977.html" target="_self"&gt;GetTemplates&lt;/A&gt; is static function of MappingExtensions class with MapMember type parameter. You need to add using :&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;using ArcGIS.Desktop.Mapping;&lt;/LI-CODE&gt;&lt;P&gt;There are 2 alternatives to use GetTemplates method:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; editTemplates = featLayer.GetTemplates();&lt;BR /&gt;// or&lt;BR /&gt;var editTemplates1 = MappingExtensions.GetTemplates(featLayer);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2024 17:00:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-all-construction-tools/m-p/1536955#M12071</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2024-09-10T17:00:20Z</dc:date>
    </item>
    <item>
      <title>Re: Remove all construction tools</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-all-construction-tools/m-p/1536976#M12072</link>
      <description>Hello,&lt;BR /&gt;I am using ArcGIS.Desktop.Mapping but it says GetTemplates does not exist and MappingExtensions also does not exist in ArcGIS.Desktop.Mapping&lt;BR /&gt;</description>
      <pubDate>Tue, 10 Sep 2024 17:54:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-all-construction-tools/m-p/1536976#M12072</guid>
      <dc:creator>JonathanDewalt</dc:creator>
      <dc:date>2024-09-10T17:54:30Z</dc:date>
    </item>
    <item>
      <title>Re: Remove all construction tools</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-all-construction-tools/m-p/1536995#M12073</link>
      <description>&lt;P&gt;What ArcGIS Pro SDK version do you use?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Sep 2024 18:11:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-all-construction-tools/m-p/1536995#M12073</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2024-09-10T18:11:50Z</dc:date>
    </item>
    <item>
      <title>Re: Remove all construction tools</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-all-construction-tools/m-p/1537028#M12074</link>
      <description>Using 3.0 and also tried in 3.3&lt;BR /&gt;</description>
      <pubDate>Tue, 10 Sep 2024 19:12:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-all-construction-tools/m-p/1537028#M12074</guid>
      <dc:creator>JonathanDewalt</dc:creator>
      <dc:date>2024-09-10T19:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: Remove all construction tools</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-all-construction-tools/m-p/1537241#M12077</link>
      <description>&lt;P&gt;I have tested on 3.1 and it works&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2024 10:48:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-all-construction-tools/m-p/1537241#M12077</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2024-09-11T10:48:17Z</dc:date>
    </item>
    <item>
      <title>Re: Remove all construction tools</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-all-construction-tools/m-p/1537436#M12082</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/472155"&gt;@JonathanDewalt&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run the tool, the Create features pane needed to be open.&amp;nbsp; If it was not open, the code did not work. In your scenario, was the Create Features pane open?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2024 17:00:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-all-construction-tools/m-p/1537436#M12082</guid>
      <dc:creator>UmaHarano</dc:creator>
      <dc:date>2024-09-11T17:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: Remove all construction tools</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-all-construction-tools/m-p/1537463#M12084</link>
      <description>Right now it won’t even compile as it says the GetTemplates does not exist even though I am using ArcGis.desktop.mapping&lt;BR /&gt;</description>
      <pubDate>Wed, 11 Sep 2024 18:08:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-all-construction-tools/m-p/1537463#M12084</guid>
      <dc:creator>JonathanDewalt</dc:creator>
      <dc:date>2024-09-11T18:08:30Z</dc:date>
    </item>
    <item>
      <title>Re: Remove all construction tools</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-all-construction-tools/m-p/1537559#M12085</link>
      <description>&lt;P&gt;Would it be possible for you to zip up your code and send it over as an attachment?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Sep 2024 22:08:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-all-construction-tools/m-p/1537559#M12085</guid>
      <dc:creator>UmaHarano</dc:creator>
      <dc:date>2024-09-11T22:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: Remove all construction tools</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-all-construction-tools/m-p/1538959#M12099</link>
      <description>&lt;P&gt;Here is a sample test class.&amp;nbsp; I get compiler errors stating that MappingExtensions and GetTemplates do not exist.&amp;nbsp;&lt;/P&gt;&lt;P&gt;using ArcGIS.Core.CIM;&lt;BR /&gt;using ArcGIS.Desktop.Framework.Threading.Tasks;&lt;BR /&gt;using ArcGIS.Desktop.Mapping;&lt;BR /&gt;using System;&lt;BR /&gt;using System.Collections.Generic;&lt;BR /&gt;using System.Linq;&lt;BR /&gt;using System.Threading;&lt;BR /&gt;using System.Threading.Tasks;&lt;/P&gt;&lt;P&gt;namespace rmg.AlbertaWildfireTools.Core&lt;BR /&gt;{&lt;BR /&gt;public class Test&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;public static async Task SetConstructionToolsAsync(object sender, Layer layer, CancellationToken cancellationToken = default(CancellationToken))&lt;BR /&gt;{&lt;BR /&gt;await QueuedTask.Run(() =&amp;gt; SetConstructionTools(sender, layer, cancellationToken));&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;public static void SetConstructionTools(object sender, Layer featLayer, CancellationToken cancellationToken = default(CancellationToken))&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;try&lt;BR /&gt;{&lt;BR /&gt;//self-documenting thread check&lt;BR /&gt;if (!QueuedTask.OnWorker) throw new ArcGIS.Core.CalledOnWrongThreadException();&lt;/P&gt;&lt;P&gt;if (cancellationToken.IsCancellationRequested == true)&lt;BR /&gt;{&lt;BR /&gt;rmg.Common.Events.ProgressBarEvents.OnTaskCancelled(sender);&lt;BR /&gt;return;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;// var featLayer = MapView.Active.Map.FindLayers("Roads").First();&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;var x = MappingExtensions.GetTemplates(featLayer);&lt;BR /&gt;var editTemplates = featLayer.GetTemplates();&lt;/P&gt;&lt;P&gt;var newCIMEditingTemplates = new List&amp;lt;CIMEditingTemplate&amp;gt;();&lt;/P&gt;&lt;P&gt;foreach (var et in editTemplates)&lt;BR /&gt;{&lt;BR /&gt;//initialize template by activating default tool&lt;BR /&gt;et.ActivateDefaultToolAsync();&lt;BR /&gt;var cimEditTemplate = et.GetDefinition();&lt;BR /&gt;//get the visible tools on this template&lt;BR /&gt;var allTools = et.ToolIDs.ToList();&lt;BR /&gt;//add the hidden tools on this template&lt;BR /&gt;allTools.AddRange(cimEditTemplate.GetExcludedToolIDs().ToList());&lt;BR /&gt;//hide all the tools then allow the line tool&lt;/P&gt;&lt;P&gt;//At 2.x -&lt;BR /&gt;//allTools.AddRange(cimEditTemplate.GetExcludedToolDamlIds().ToList());&lt;BR /&gt;allTools.AddRange(cimEditTemplate.GetExcludedToolIDs().ToList());&lt;/P&gt;&lt;P&gt;//At 2.x -&lt;BR /&gt;//cimEditTemplate.SetExcludedToolDamlIds(allTools.ToArray());&lt;BR /&gt;//cimEditTemplate.AllowToolDamlID("esri_editing_SketchLineTool");&lt;/P&gt;&lt;P&gt;cimEditTemplate.SetExcludedToolIDs(allTools.ToArray());&lt;BR /&gt;cimEditTemplate.AllowToolID("rmg_AlbertaWildfireTools_Buttons_Editing_ConstructionTool_FireLine");&lt;BR /&gt;newCIMEditingTemplates.Add(cimEditTemplate);&lt;BR /&gt;}&lt;BR /&gt;//update the layer templates&lt;BR /&gt;var layerDef = featLayer.GetDefinition() as CIMFeatureLayer;&lt;BR /&gt;// Set AutoGenerateFeatureTemplates to false for template changes to stick&lt;BR /&gt;layerDef.AutoGenerateFeatureTemplates = false;&lt;BR /&gt;layerDef.FeatureTemplates = newCIMEditingTemplates.ToArray();&lt;BR /&gt;featLayer.SetDefinition(layerDef);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;}&lt;BR /&gt;catch (Exception ex)&lt;BR /&gt;{&lt;BR /&gt;rmg.Common.Events.ProgressBarEvents.OnTaskCancelled(sender);&lt;BR /&gt;// errorHandler.WriteError(ex, "kkkkfeer");&lt;BR /&gt;return;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2024 15:11:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-all-construction-tools/m-p/1538959#M12099</guid>
      <dc:creator>JonathanDewalt</dc:creator>
      <dc:date>2024-09-16T15:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: Remove all construction tools</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-all-construction-tools/m-p/1539426#M12102</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have added your class to Esri Community sample AddFeatureTest,&amp;nbsp; commented 2 lines with&amp;nbsp;rmg.Common.Events.ProgressBarEvents.OnTaskCancelled and compiled without problems.&lt;/P&gt;&lt;P&gt;Check your Visual Studio project, .Net framework version, installed ArcGIS extensions and etc.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2024 13:14:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-all-construction-tools/m-p/1539426#M12102</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2024-09-17T13:14:03Z</dc:date>
    </item>
    <item>
      <title>Re: Remove all construction tools</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-all-construction-tools/m-p/1541641#M12111</link>
      <description>&lt;P&gt;Got it working.&amp;nbsp; My code was missing the ArcGIS .Desktop.Extensions reference.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2024 20:44:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/remove-all-construction-tools/m-p/1541641#M12111</guid>
      <dc:creator>JonathanDewalt</dc:creator>
      <dc:date>2024-09-23T20:44:17Z</dc:date>
    </item>
  </channel>
</rss>

