AnsweredAssumed Answered

Remove Unwanted Sketch Tools and Set Default

Question asked by mjk5000 on Nov 6, 2018
Latest reply on Nov 6, 2018 by sean_jones-esristaff

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)
{

try
{
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)
{
//TOOL OPTIONS IS NULL?
}

//Set the templates and layer definition back on the layer
layerDef.FeatureTemplates = layerTemplates.ToArray();
inFeatLayer.SetDefinition(layerDef);
}
});
}
catch (Exception e)
{
return;
}
}

Outcomes