Select to view content in your preferred language

ModelBuilder & Its Exported Python Script

1229
5
Jump to solution
08-14-2013 08:02 AM
ShaningYu
Honored Contributor
I tested ModelBuilder and Python scripts in such 2 scenarios.  The results are posted below.  Hopefully you can help me for some questions.
Scenario One:  No parameter in ModelBuilder
1)  Run the ModelBuilder - Successful.
2)  Run the script exported from the ModelBuilder in PythinWin - Successful.
3)  Run the Script tool that sources from the python script in 2) in Catalog - Successful.
Scenario Two:  With parameter in ModelBuilder
1)  Run the ModelBuilder - Successful.
2)  Run the script exported from the ModelBuilder in PythinWin - Failed and no parameter input boxes.
3)  Run the Script tool that sources from the python script in 2) in Catalog - Failed and no parameter input boxes.
The results impress me that
1)  The scripts from the ModelBuilder with parameters do not work well.
2)  To setup the parameters in python scripts, related python's syntax has to be used.
Is my understanding correct?  Please feedback me your experience.  Thanks.
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
ShaningYu
Honored Contributor
Chris:
You are right.  I just did another test as described below:
1) Run the script of the ESRI's MultiRingBuffer tool (\Analysis Tool\Proximate) in Python.  No parameter boxes display.
2) Check the ESRI's MultiRingBuffer tool and observed that the Parameters are set in the Properties wizard.
If so, it appears that there is no advantage to use python script for dynamic inputs. 
Thanks for your feedback.
Yours,
Shaning

View solution in original post

0 Kudos
5 Replies
ChristopherBlinn1
Deactivated User
Shaning,

Your assumption that parameters in scripts not working is correct.  To address this, after exporting scripts from ModelBuilder, I usually go back through and all parameters using this resource page as a template.

Notice how the parameters have object fields which allow you to specify the type of parameter and so on.

I still need to learn a great bit of Python, but like you, I still use ModelBuilder as a starting point, then usually customize and cleanup the scripts later.

Hope this helps!
Chris B.
0 Kudos
ShaningYu
Honored Contributor
Chris:
You are right.  I just did another test as described below:
1) Run the script of the ESRI's MultiRingBuffer tool (\Analysis Tool\Proximate) in Python.  No parameter boxes display.
2) Check the ESRI's MultiRingBuffer tool and observed that the Parameters are set in the Properties wizard.
If so, it appears that there is no advantage to use python script for dynamic inputs. 
Thanks for your feedback.
Yours,
Shaning
0 Kudos
MichaelVolz
Esteemed Contributor
What do you mean by "dynamic inputs"?
0 Kudos
ShaningYu
Honored Contributor
I should state that enter some values as variables.
I did another test that set workspace as a parameter.  It works in Desktop application.  But when the tool is published as a geoprocessing tool, this parameter is filter out.  Did you experience like that if you have work on Server geoprocessing tools?
0 Kudos
MichaelVolz
Esteemed Contributor
I only have 1 ArcGIS Server script where I update caches from a Scheduled Task.  It is not a published geoprocessing tool.  I have a bat file that calls a python script where parameters for the python script are read in from a config file.
0 Kudos