Thursday, 30 March 2017

arcpy - Binding Objects to List for ArcGIS Python Script Tool Parameter?




I am working on a python based script/tool. I would like to make use of drop down lists for several of the parameters. This is very easy to do if the lists are just plain old strings.


Does anyone know if it is possible to bind objects to this list and display a certain property? Objects will be very simple; just key-value pairs.


So, I would like to display the key and be able to access the value somewhere in the ToolValidator, or better yet access the ToolValidator class from the tool script itself?



Answer



Since you know that you can provide a potential list of acceptable values to a tool parameter, you could try using the selected value from the domain, as the key to a dictionary residing in your main script.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...