This is my problem: How I can export to a feature class my sublayer Routes from outNALayer.
I been able to export just the tabular data but NOT the geometry. Down below is the code or part of the script.
Thanks
# Process: Create a Closest Facility Layer. Optimize on Travel Time but compute the distance traveled by accumulating the meters attribute.
outRouteResultObject = arcpy.na.MakeClosestFacilityLayer(Transportation_ND, "Closest_Facility", "Miles", "TRAVEL_TO", "", "1", "Miles", "ALLOW_UTURNS", "Oneway", "NO_HIERARCHY", "", "NO_LINES", "", "NOT_USED")
print "Creating Closest Facility Layer"
# Get the layer object from the result object. The route layer can now be referenced using the layer object.
outNALayer = outRouteResultObject.getOutput(0)
print "outNALayer : " + str(outNALayer)
# Get the names of all sublayers within the route layer.
subLayerNames = arcpy.na.GetNAClassNames(outNALayer)
print "subLayerNames : " + str(subLayerNames)
# Store the layer names that we will use later - Facilities
facilityLayerName = subLayerNames["Facilities"]
print "facilityLayerName : " + str(facilityLayerName)
# Store the layer names that we will use later - incidents
incidentsLayerName = subLayerNames["Incidents"]
print "incidentsLayerName : " + str(incidentsLayerName)
# Store the layer names that we will use later
routeLayerName = subLayerNames["CFRoutes"]
print "routeLayerName : " + str(routeLayerName)
# Process: Add destination points.
arcpy.na.AddLocations(outRouteResultObject, facilityLayerName, Facilities, "", "1000 Meters", "", "test_area SHAPE;Transportation_ND_Junctions NONE", "MATCH_TO_CLOSEST", "CLEAR", "NO_SNAP", "5 Meters", "INCLUDE", "test_area #;Transportation_ND_Junctions #")
print "Adding Faclitities to the Closest Facility layer"
# Process: Add Origin points.
arcpy.AddLocations_na(outRouteResultObject, incidentsLayerName, Incidents, "", "1000 Meters", "", "test_area SHAPE;Transportation_ND_Junctions NONE", "MATCH_TO_CLOSEST", "CLEAR", "NO_SNAP", "5 Meters", "INCLUDE", "test_area #;Transportation_ND_Junctions #")
print "Adding Incidents to the Closest Facilty layer"
# Process: Solve
arcpy.na.Solve(outNALayer, "SKIP", "TERMINATE", "")
print "Solving the Problem"
RoutesSubLayer = arcpy.mapping.ListLayers(outNALayer,routeLayerName)[0]
print "Selected sublayer : " + str(RoutesSubLayer)
#arcpy.FeatureClassToFeatureClass_conversion(RoutesSubLayer, network)