ModelBuilder: "Merge Branch"

479
0
02-20-2013 05:52 AM
PeterWilson
Occasional Contributor III
I've generated a model in ModelBuilder to automate the terrain preprocessing steps within ArcHydro. I've taken it a step further and generated a python condition script based on an argument supplied by the user to determine if Batch Watershed and Batch Subwatershed analysis is required. I then want to use "Merge Branch" to run the remaining processes as they are the same for Watersheds or Subwatershed. The problem that I have is either Batch Watershed or Batch Subwatershed will run due to the python condition statement and when I add both output to Merge Branch it won't run as its expecting both and not one or the other. I've attached my Python Script and as well as my ArcHydro Model.

Python Script:

# Import system modules
import arcpy

#Set the parameters
basinType = arcpy.GetParameterAsText(0)

try:
    if basinType == "Subwatershed":
        arcpy.SetParameterAsText(1,"True")
        arcpy.SetParameterAsText(2,"False")

    elif basinType == "Watershed":
        arcpy.SetParameterAsText(1,"False")
        arcpy.SetParameterAsText(2,"True")

except Exception as e:
        AddPrintMessage (e[0],2)
0 Kudos
0 Replies