3

I found a python script (Drawing parallel lines inside polygons (Well Paths)?) I would like to use in an analysis. However, I don't understand how to add the script posted by @phloem to ArcMap.

Following an an older tutorial, for ArcMap 9.2 (http://webhelp.esri.com/arcgisdesktop/9.2/tutorials/GP_3_3.htm) assisted me in the creation of a script within a toolbox. But, after running the new script, the dialogue box says "no parameters".

How do I setup the new script, along with the relevant parameters necessary to execute the script as a tool? I am using ArcMap 10.3.1

3
  • so you are looking to set up the parameters of your script, not add a script to arcmap yes? please clarify
    – Maksim
    Sep 27, 2016 at 19:16
  • I have never worked with scripts before. So, please excuse my limited understanding of the vocab involved. I did manage to edited the question to reflect setting up a new script and parameters. Hope it helps. Sep 27, 2016 at 20:13
  • @slyWhiteSheep Can you share the screen shots of the parameters tab after you set this script up? Mar 28, 2019 at 18:26

1 Answer 1

8

Sounds like you already successfully added your script to the toolbox, so you're close. You just need to set the parameters that are listed in the script within ArcMap if you want to run the script as a tool. In your catalog, right click on your script tool that you created and click on properties. You need to define your parameters under the parameters tab.

So, you would set your first parameter up like this:

Display Name - polyFC (or whatever you want it to be displayed as in the tool) Data Type - String

Under parameter properties, you would set the following: Type - Feature layer Direction - Input

You can then add the rest of your parameters, though the parameter properties and types may be different depending upon how they are used in the script.

The only other thing to note is that parameters defined in ArcMap need to be in the same order as the ones defined in your script.

Here's a good page on setting parameters: http://desktop.arcgis.com/en/arcmap/10.3/analyze/creating-tools/setting-script-tool-parameters.htm

And here's the page that lists all the different types of parameters (sometimes all the different types can get confusing, so it's nice to have a list!): http://pro.arcgis.com/en/pro-app/arcpy/geoprocessing_and_python/defining-parameter-data-types-in-a-python-toolbox.htm

2
  • Thank you for the helpful links, and instructions. Following your post I was able to setup the parameters, and execute the script! Very helpful. Sep 27, 2016 at 20:39
  • 2
    @SlyWhiteSheep If this worked for you please consider marking it as the answer. See What should I do when someone answers my question?
    – Midavalo
    Sep 28, 2016 at 0:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.