jodicross

Scripting "Create Geometric Network" Input feature class problem

Discussion created by jodicross on Jan 31, 2014
I'm trying to write a script that will ultimately create a large number of geometric networks for a stream basin modeling project. The script will run through a list of geodatabases, and in each gdb it will create a feature dataset for each feature class present and then import that feature class into the dataset. It will then create a geometric network using that feature class within the new dataset.

Now I can get the script to successfully create the datasets and import the feature classes, but for some reason the Create Geometric Network tool will not accept a variable for the "in_source_feature_classes" parameter. If I put anything other than the actual name of an existing feature class I get an error.

A copy of my script is attached below. If anyone has any solutions, ideas, suggestions....anything, I'd really appreciate it

Thanks

# Import arcpy module
import arcpy

# Get the workspace parameter
input_GDB = arcpy.GetParameterAsText(0)
# Set the input workspace
arcpy.env.workspace = input_GDB
arcpy.env.overwriteOutput = True
# List the feature classes in the workspace
fcList = arcpy.ListFeatureClasses()
# Loop through feature classes
for fc in fcList:
 # set up new-name variables
 basin = fc[:-10]
 fdsName = basin+"_Hydro"
 newFCname = basin+"Flowlines"
 netName = basin+"_Hydro_Net"
 
 # create feature dataset
 newFDS = arcpy.CreateFeatureDataset_management (input_GDB, fdsName, fc)
 # import feature class
 newFC = arcpy.FeatureClassToFeatureClass_conversion (fc, newFDS, newFCname)
 # Create Geometric Network
 GeoNet = arcpy.CreateGeometricNetwork_management (fds, netName, "newFC SIMPLE_EDGE NO", "", "", "", "", "PRESERVE_ENABLED")
 # Set Flow Direction
 #arcpy.SetFlowDirection_management(GeoNet, "WITH_DIGITIZED_DIRECTION")

Attachments

Outcomes