Select to view content in your preferred language

How to programmatically activate the edit tools in arcpro sdk

922
4
Jump to solution
10-26-2024 12:49 PM
Gurunara
Frequent Contributor

would like to activate:

1) Create feature

2) Modify feature, and in particular the Move option

3) Delete feature

tools under the Edit tab, programmatically for a specific feature layer, and subscribe to the edit completion events.

Is this possible in arcpro sdk?

0 Kudos
2 Solutions

Accepted Solutions
GKmieliauskas
Esri Regular Contributor

Hi,

Use GetPlugInWrapper Method—ArcGIS Pro. To find tool reference id move mouse over the tool.

GKmieliauskas_0-1730128508697.png

 

View solution in original post

GKmieliauskas
Esri Regular Contributor

I think, you can't select template directly from Create Features pane. But your workflow could be like in sample below:

        protected async override void OnClick()
        {
            await QueuedTask.Run(() =>
            {
               // Find layer you will work with
                var featLayer = MapView.Active.Map.FindLayers("Poly1").First();
                // Get all templates and then select template you need or use GetTemplate if you know template name
                var editTemplates = featLayer.GetTemplates();

                if (editTemplates != null && editTemplates.Count > 0)
                {
                    var editTemplate = editTemplates[0];
                    // Activate default tool
                    editTemplate.ActivateDefaultToolAsync();
                }
            });
        }

View solution in original post

4 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

Use GetPlugInWrapper Method—ArcGIS Pro. To find tool reference id move mouse over the tool.

GKmieliauskas_0-1730128508697.png

 

Gurunara
Frequent Contributor

Works...

0 Kudos
Gurunara
Frequent Contributor

is there a way to programmatically select a template once the Create Feature tool is activated?

Gurunara_0-1730291847775.png

 

0 Kudos
GKmieliauskas
Esri Regular Contributor

I think, you can't select template directly from Create Features pane. But your workflow could be like in sample below:

        protected async override void OnClick()
        {
            await QueuedTask.Run(() =>
            {
               // Find layer you will work with
                var featLayer = MapView.Active.Map.FindLayers("Poly1").First();
                // Get all templates and then select template you need or use GetTemplate if you know template name
                var editTemplates = featLayer.GetTemplates();

                if (editTemplates != null && editTemplates.Count > 0)
                {
                    var editTemplate = editTemplates[0];
                    // Activate default tool
                    editTemplate.ActivateDefaultToolAsync();
                }
            });
        }