Combing Multiple Models

3343
16
Jump to solution
08-28-2013 08:24 AM
CraigCarsley
Occasional Contributor II
I'm starting to get a feel for Model Builder, but I can't figure this out:

I've got 9 geoprocessing models that are all part of the same essential process.  I want to have one model, or script, that will run each one of them consecutively.  I tried doing everything in a single model, but I got red exes on some of the tools because I am overwriting some datasets.  At the same time, it could be useful to keep each step separated anyway.

So, does anyone know of anyway to automate running 9 models consecutively?

Thanks!
0 Kudos
16 Replies
CraigCarsley
Occasional Contributor II
Thanks for the help Russell.  I'm still having a little trouble.  This is my code:

import arcpy

arcpy.ImportToolbox(r"X:\GIS_Projects\Street_Centerlines\Update.tbx","Streets")

#arcpy.Tool0_PreScript_Streets()
arcpy.Tool1_DeleteStreets_Streets()
arcpy.Tool2_CopyData_Streets()
arcpy.Tool3_CalcROADCLASS_Streets()
arcpy.Tool4_AppendStreets_Streets()
arcpy.Tool5_CalcPSAP_Streets()
arcpy.Tool6_CalcMUNILEFT_Streets()
arcpy.Tool7_CaclMUNIRIGHT_Streets()


I'm getting this error at the moment:

Traceback (most recent call last):
  File "X:/GIS_Projects/Street_Centerlines/Python_Scripts/Automate_StreetUpdate2", line 6, in <module>
    arcpy.Tool1_DeleteStreets_Streets()
AttributeError: 'module' object has no attribute 'Tool1_DeleteStreets_Streets'


I can't quite figure out what I'm doing wrong... any thoughts?

Thanks
0 Kudos
RussellBrennan
Esri Contributor
Check your casing. Python is case sensitive.
Double check that the tool name is spelled correctly.

If you un-comment out the first tool does it execute successfully?
0 Kudos
CraigCarsley
Occasional Contributor II
Casing is all correct. 
I commented out Tool0_PreScript because it returned the error.  After that, Tool1_DeleteStreets returned the error.  The script seems to stumble over any line in that part of the script.
0 Kudos
RussellBrennan
Esri Contributor
Go into your model properties and check that the name of the model is what you are using. The label is what appears in ArcCatalog when you are browsing. The name is what python uses to find the tool. You can have a name and label that are completely different from one another.
0 Kudos
CraigCarsley
Occasional Contributor II
Russell,

That was definitely the problem I was running into, so thank you!
Unfortunately, I've hit another error.  Have you ever seen something like this:

[ATTACH=CONFIG]27171[/ATTACH]

I can't tell if the script just hit a snag on one of the values, or if I really can't execute a VB Expression as part of one of the models.
Would love to have your thoughts.

Thanks!
0 Kudos
MichaelVolz
Esteemed Contributor
Craig:

I believe you need to convert the VB Expression to a python expression to support ArcGIS Server services.  There should be plenty of help to assist you in the python format, but if you can not locate help I'll try to dig up some sample syntax for you.
0 Kudos
CraigCarsley
Occasional Contributor II
Michael,

Yes, I went ahead and just did it.  Generated a few other errors, but I think its working now. 
Thank you all for your input!
0 Kudos