<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Scripting &amp;amp;quot;Create Geometric Network&amp;amp;quot; Input feature class problem in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/scripting-amp-quot-create-geometric-network-amp/m-p/411293#M32423</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;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. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A copy of my script is attached below. If anyone has any solutions, ideas, suggestions....anything, I'd really appreciate it&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;

# 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")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 31 Jan 2014 21:52:33 GMT</pubDate>
    <dc:creator>JodiCross</dc:creator>
    <dc:date>2014-01-31T21:52:33Z</dc:date>
    <item>
      <title>Scripting &amp;quot;Create Geometric Network&amp;quot; Input feature class problem</title>
      <link>https://community.esri.com/t5/python-questions/scripting-amp-quot-create-geometric-network-amp/m-p/411293#M32423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;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. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A copy of my script is attached below. If anyone has any solutions, ideas, suggestions....anything, I'd really appreciate it&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;

# 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")&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 Jan 2014 21:52:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/scripting-amp-quot-create-geometric-network-amp/m-p/411293#M32423</guid>
      <dc:creator>JodiCross</dc:creator>
      <dc:date>2014-01-31T21:52:33Z</dc:date>
    </item>
  </channel>
</rss>

