Create a custom Geoprocessing pane

1464
6
Jump to solution
04-06-2020 06:05 PM
AbelPerez
Occasional Contributor III

So am not sure how to ask this but when in ArcGIS Pro 2.5 I can pull up the Geoprocessing pane and then execute a geoprocessing function like "Buffer". How would I do something similar in my custom add-in? Basically I am taking 3 standard ESRI geoprocessing functions and setting my companies standard options internally so the user doesn't have to do it and then running the entire chain to get an output.

I'm looking through the tons of community samples but cant figure out where to start.

1 Solution

Accepted Solutions
NobbirAhmed
Esri Regular Contributor

In this youtube channel you'll find all presentations made during Developer Summit 2020:

Esri 2020 Developer Summit Tech Sessions - YouTube 

Of the many presentations, I think the following one will help you most:

https://www.youtube.com/watch?v=1HgPRTmNAOM&list=PLaPDDLTCmy4Ys8vfmC7DbX3FHSsyosvh7&index=17&t=186s

Let me know how it goes. If you have any question please post it here.

View solution in original post

0 Kudos
6 Replies
by Anonymous User
Not applicable

Hi Abel Perez‌,

You might want to take a look at this sample.

arcgis-pro-sdk-community-samples/AddAField.cs at master · Esri/arcgis-pro-sdk-community-samples · Gi... 

Or

You can create your own python toolbox for multiple arcpy command and call in the following way.

 var arguments = Geoprocessing.MakeValueArray([parameters seperated by comma]);
                //Geoprocessing.OpenToolDialog([pyt python toolbox file path], arguments); //- for general testing to check your arguments are correct
                
                var gpResult = Geoprocessing.ExecuteToolAsync([pyt python toolbox file path], arguments);//execute

                using (var progress = new ProgressDialog("processing python tool"))
                {
                    var status = new ProgressorSource(progress);
                    progress.Show();

                    gpResult.Wait();

                    progress.Hide();

                }
                

                IGPResult ProcessingResult = gpResult.Result;
                if (ProcessingResult.IsFailed)
                {
                    string errorMessage = "";
                    foreach (IGPMessage gpMessage in ProcessingResult.Messages)
                    {
                        errorMessage += $"{{Error Code: {gpMessage.ErrorCode}, Text :  {gpMessage.Text} }}";
                    }
                   //for general error message
                }
AbelPerez
Occasional Contributor III

This is an add-in so I am doing everything through .NET and WPF.

NobbirAhmed
Esri Regular Contributor

Hi Abel, thanks for this useful question. 

One way, as @Than Aung stated, is to call a Python script tool (or a ModelBuilder model tool) and call the tool by clicking on a button - the tool dialog will be shown in Geoprocessing pane. You can combine multiple tools while exposing only a few of the parameters (using organizational defaults for the other parameters) - the user will enter data and execute the tool. You can capture the result and use that in your next task in sequence.

Using a custom ModelBuilder or Python script tool will hugely minimize the amount of code they would need to manage.

The way you are looking for is to create a dockpane app, where you'll create a WPF dialog and provide parameters etc. Let me create a simple sample - I 'll share it once ready. 

Thanks, Nobbir Ahmed

Esri GP team.

0 Kudos
AbelPerez
Occasional Contributor III

My add-in logic is all written in .NET so that's where my confusion is. I don't code very much in Python and am looking for just a way to get the users to provide input, run some code, and then use the geoprocessing functions. But all through ArcObjects (if that's what its still called in Pro SDK).

0 Kudos
NobbirAhmed
Esri Regular Contributor

In this youtube channel you'll find all presentations made during Developer Summit 2020:

Esri 2020 Developer Summit Tech Sessions - YouTube 

Of the many presentations, I think the following one will help you most:

https://www.youtube.com/watch?v=1HgPRTmNAOM&list=PLaPDDLTCmy4Ys8vfmC7DbX3FHSsyosvh7&index=17&t=186s

Let me know how it goes. If you have any question please post it here.

0 Kudos
AbelPerez
Occasional Contributor III

Very good video indeed. The control I was needing is the Dockpane.

Many Thanks.

0 Kudos