There are differences between ArcGIS Pro toolboxes with different versions; if you have versions lower than 2.9, the configuration is somewhat different, and if it is 2.9 or later, a couple of aspects change. Having said that, we will proceed with a small example of how to do it if you have a version lower than 2.9.<\/P>
This is simply an example showing an exercise on how to create a toolbox; it does not include the toolbox or the script, it only aims to help configure one.<\/P>
- Open ArcGIS Pro<\/LI>
- Create a new toolbox or use the project toolbox (if you choose to use the project toolbox, you must save the project)<\/LI>
- In the toolbox you created or if you are using one from the project, right-click and select New
Script<\/LI><\/OL>
<\/span><\/P>4. A window like the following appears<\/P>
<\/span><\/P>5. In Name, you must put a name without spaces, accents, or any special character. In Label, you can put a name with spaces and accents.<\/P>6. In Script File is where you call the script; this is how you find it with the folder button<\/P>
<\/span><\/P>7. Then go to the Parameters tab<\/P>
<\/span><\/P> <\/P>8. Here you must put the parameters defined in the script; for this, I recommend opening the script with ArcGIS Pro's Idle or with a notepad because, for example, everything indicated in the script as arcpy.GetParameterAsText() will correspond to the parameters you will place here, and these match the order of what you add in this parameters section in the tool. Therefore, if in the script it says arcpy.GetParameterAsText(0), this will be the first parameter. In fact, you can see in the next image that on the left side of the Label column there is numbering from 0 to 3 because in this example, the script has 4 parameters, so inside the script there will be: arcpy.GetParameterAsText(0), arcpy.GetParameterAsText(1), arcpy.GetParameterAsText(2), and arcpy.GetParameterAsText(3)<\/P>
<\/span><\/P>9. The names correspond to the parameters we are calling in the script; in some cases, it can be a layer, a table, a workspace, text, etc. These also have direction, meaning whether the parameter we are calling is an input or an output element.<\/P>In the example, I had a workspace as the first parameter; that's why I put Workspace in Label and since it is a workspace, I selected Workspace in Data Type. The second was an input layer, so I put Input Layer and selected Feature Layer in Data Type. The third was the Output Layer and in Data Type I selected String; since it is an output, Direction Output is selected here. Finally, the last one was a text value; for this case, in Label I wrote Input Period and Data Type is string.<\/P>10. In some cases we must move to the right to set other options<\/P>For example: in this case, the first parameter was a workspace; that's why in the first where Workspace was written in Label, I selected Environment Current workspace.<\/P>
<\/span><\/P> <\/P>11. For this specific case inside the script there were some options; therefore, to pass them here I passed them as a list in the Filter field. That's why in Input Period under Filter I selected Value List displaying a box where I wrote these two options: CR05 and CR-SIRGAS (each new option is added with the green cross). After adding those values to the list, I pressed Ok.<\/P>Note: each option must be exact to what you place in your scripts; if something changes it will not work. For example: if in my case CR05 exists in the script, it would not work if I had put cr05 because Python is case sensitive and if you place another value unrelated to what you have in your script and use something similar to what I did, it would not work.<\/STRONG><\/P>
<\/span><\/P>It is also possible to select default values; for example, in my case I need CR05 to exist by default; therefore, in Default I wrote CR05. So for this case it looks like this<\/P>
<\/span><\/P>12. Now press Ok<\/P>13. Your tool is ready; remember where you saved it or which project you left it in. In my case it looks like this.<\/P>
<\/span><\/P>I hope this small guide helps you; on another occasion I will explain the process with Tools for versions higher than ArcGIS Pro 2.9<\/