Clip and Ship example, parameter index

886
2
Jump to solution
07-06-2020 03:49 AM
VictorTey
Esri Contributor

Hi, I am going through the clip and ship example, can some please help me understand how does

gp.getparameterastext(0)

the index match up? 

my parameter has 5 parameters 

However in the code there are 7 parameter. In the parameter above, output zip should have been 4 however in the code it is using 6. if coordinateSystem and customCoordSystemFolder are not set as parameter (just variable) how does it know the index of it?

Also how do you configure the in_memory attribute? Can i just declare a in_memory variable by specifying in_memory\whatever I want? how does it know what the attributes are?

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
MehdiPira1
Esri Contributor

Hi Victor Tey‌,

The Extract Data tool in ArcToolbox contains 7 parameters. It's zero-indexed.

If you go to the properties of the tool and click parameters, you will see there are 7 parameters already set up.

If you want to update or change any parameters, you need to make a copy of the tool and paste it somewhere else e.g. Toolbox.tbx in Home - Documents\ArcGIS directory.

The Area of Interest you are pointing to is a feature set. The way I use is export the model builder into a script, do the changes there, make a tool out of it. 

Area_of_Interest = "in_memory\\{3429FFB4-5050-4D6E-B6BF-3266C230BC5F}"

Then bring it back into a new model builder should you wish to use it with other tools in model builder, otherwise you can carry on with the script.

View solution in original post

2 Replies
MehdiPira1
Esri Contributor

Hi Victor Tey‌,

The Extract Data tool in ArcToolbox contains 7 parameters. It's zero-indexed.

If you go to the properties of the tool and click parameters, you will see there are 7 parameters already set up.

If you want to update or change any parameters, you need to make a copy of the tool and paste it somewhere else e.g. Toolbox.tbx in Home - Documents\ArcGIS directory.

The Area of Interest you are pointing to is a feature set. The way I use is export the model builder into a script, do the changes there, make a tool out of it. 

Area_of_Interest = "in_memory\\{3429FFB4-5050-4D6E-B6BF-3266C230BC5F}"

Then bring it back into a new model builder should you wish to use it with other tools in model builder, otherwise you can carry on with the script.

VictorTey
Esri Contributor

Thank you Mehdi Pira‌, you are spot on. I didn't not realise you can define the parameters under the scripts. Thank you