I want to add multiple selected features into the trace locations using the arcpy.un.AddTraceLocations() method but i am not able to do that I am using this set of code
result = arcpy.management.SelectLayerByAttribute(
in_layer_or_view="ElectricDevice",
selection_type="NEW_SELECTION",
where_clause="ASSETGROUP = 38",
invert_where_clause=None
)
with arcpy.da.SearchCursor(result, "*") as cursor:
for row in cursor:
arcpy.un.AddTraceLocations(
in_utility_network=r"D:\UNM\GDB\Naperville_Electric_2213.gdb\UtilityNetwork\Network",
out_feature_class=feature_class_path,
load_selected_features="LOAD_SELECTED_FEATURES",
clear_trace_locations="KEEP_LOCATIONS",
trace_locations=row,
filter_barrier="TRAVERSABILITY_BARRIER"
)
Does nothing happen or did you get an error? Did your selection work? (try it manually and copy the code snippet)
Select Layer By Attribute (Data Management)—ArcGIS Pro | Documentation
or did it fail at this stage?
Add Trace Locations (Utility Network)—ArcGIS Pro | Documentation
(eg feature_class_path)
And finally, why use a cursor when you can make the selection and just add the paths from its result?
what is the destination of the result? gdb? or enterprise?
Yes the Select layer By Attribute is working and also i am getting the selected features .
But after that the Add Trace Locations tool is not adding the features into the feature_class_path.
the destination is gdb.
Not getting any error but the Add Trace Location is not adding the features.
did you ever resolve this?
Hey man having the same problem here, Have you solved this?
Hi, I don't think you can add the row from a cursor directly into the trace_location parameter.
It should be formatted as follows :
"'FC name' {featureGlobalID} 'terminal' percentageAlong"
Did you finally succeed ?