Select to view content in your preferred language

Remove Unwanted Sketch Tools and Set Default

11-06-2018 08:08 AM
Occasional Contributor III

I want to programatically remove some tools from my configuration that I don't want a user to be able to use and also to set a default tool other than polygon.  So below for my Active template, I ant to remove all tools but polygon and RAD Tool, then make the RAD Tool the default.  I feel like I need to update the ToolOptions of the CIMEditingTemplate, but it is always null?  Am I even on the correct place to accomplish this?

private static async void UpdateEditTemplates(FeatureLayer inFeatLayer)

 await QueuedTask.Run(() =>
 //Get CIM layer definition

 if (inFeatLayer.GetDefinition() is CIMFeatureLayer layerDef && !layerDef.FeatureTemplates.IsNullOrEmpty())
 //Get all templates on this layer
 List<CIMEditingTemplate> layerTemplates = layerDef.FeatureTemplates.ToList();

 //Remove templates matching a pattern
 foreach (CIMEditingTemplate CIMTemp in layerTemplates)

 //Set the templates and layer definition back on the layer
 layerDef.FeatureTemplates = layerTemplates.ToArray();
 catch (Exception e)
0 Kudos
1 Reply
by Anonymous User
Not applicable

You can only do part of this at the moment.

The default template tool can be set through CIMEditingTemplate.SetDefaultToolDamlID

You can get a list of visible tools for a template with EditingFeatureTemplate.ToolIDs which returns an array of damlID's.

Tools are hidden on a template through CIMEditingTemplate.ToolFilter which takes a string array of guids.

You cant get a tool guid from the damlID in the public api. This will be enhanced in a future release...

0 Kudos