I want to create and trace a geometric network in model builder with python but it does not work.
I get the following error for the "Create geometric Network" tool when I execute the script in model builder:
SyntaxError: invalid syntax (create_network.py, line 16) Failed to execute (CreateGeometricNetwork ).
Are the settings and the code right? The first four entries are definded as required inputs, the last one ("Network_Net") is defined as a derived output.
Thanks for your help.
Looks like the issue is when you try and create the geometric network:
It doesn't look like you have the variable 'networkdataset' defined. I believe this should be 'FeatureDataset'. Also, there should be a comma after the first variable (i.e. FeatureDataset, "network_Net", .....).
I changed the code so that the Sccript only creates the geometric network, know it always crashes ArcMapw when I start the execution.
FeatureDataset = arcpy.GetParameterAsText(0)
FeatureClass1 = arcpy.GetParameterAsText(1)
FeatureClass2 = arcpy.GetParameterAsText(2)
FeatureClass3 = arcpy.GetParameterAsText(3)
OutputGroupLayer = arcpy.GetParameterAsText(4)
FeatureClasses = "'" + FeatureClass1 + " COMPLEX_EDGE NO;" + FeatureClass2 + " SIMPLE_JUNCTION YES;" + FeatureClass3 + "SIMPLE_JUNCTION YES" + "'"
Weights = "'" + FeatureClass1 + "SR_L_m Kosten" + "'"
arcpy.CreateGeometricNetwork_management(FeatureDataset, "network_Net", FeatureClasses, "", "Kosten DOUBLE #", Weights, "", "PRESERVE_ENABLED")