I would like to set the tolerance option for the polygon streaming tool. Has anyone done that and can point me in the right direction? I'm looking at CIMEditingTemplateToolOptions, but struggling to use it.
Thanks!
- Dave WIlcox
Hi Dave,
Is this the info you are looking for?
//Set snapping options via get/set options
var snapOptions = Snapping.GetOptions(myMap);
snapOptions.IsSnapToSketchEnabled = true;
snapOptions.XYTolerance = 100;
snapOptions.IsZToleranceEnabled = true;
snapOptions.ZTolerance = 0.6;
Snapping.SetOptions(myMap,snapOptions);
https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Editing#snapping
That's close, but this is a different setting related to the stream tool.
- Dave
>> I'm looking at CIMEditingTemplateToolOptions, but struggling to use it.
hi Dave, so this is a v specialized "setting" in the template. Essentially, if u are authoring a construction tool and want to associate it with a custom UI for "configurable options" on the create features pane u implement something called a ToolOptionsEmbeddableControl. Any custom option settings u wld like to persist in the template go in the CIMEditingTemplateToolOptions (which is a dictionary fyi but is null by default).
we hv covered this in various Dev Summit sessions. Most recently this year:
https://esri.github.io/arcgis-pro-sdk/techsessions/2023/PalmSprings/Intermediate-Editing-2.zip
(u can find a complete listing of our sessions here: https://github.com/Esri/arcgis-pro-sdk/wiki/Tech-Sessions )
this shld help u get up to speed.
Look at the section "Construction Tool - Tool Options UI" in the ppt for how to implement a ToolOptionsEmbeddableControl. This base class (u inherit from) provides a GetToolOption and SetToolOption that does the magic for u. LoadFromToolOptions, another override, gives your custom UI an opportunity to retrieve the custom options (if any) before your UI is initialized.
Editing_2_ConstructionTool.zip which is included in the download has the example code as described in the slides.
Attached is an addin that creates a Polygon construction tool. This tool implements "ToolOptions". In the Options UI, I added a text box for Tolerance.
Then on the Tool activate callback, I used the tolerance provided in the options UI and to set the map's snapping environment's XY Tolerance like this:
var snapOptions = Snapping.GetOptions(ActiveMapView.Map);
snapOptions.XYTolerance = ToleranceToolOption;
Snapping.SetOptions(ActiveMapView.Map, snapOptions);