ArcToolbox geoprocessing tools (and therefore arcpy) tend to run either on an entire dataset (if there is no selection) or on a selection set (if it exists). How can I set up an arcpy script that will have some tools run on the entire dataset while others run on just the selection set?
Scenario - I have a script that does some geometric network traces based on a selection of water mains. When this is run the script modifies the Enabled flag on a number of network points to modify the trace results. I have found that I also need to modify some of the network lines, however when I run the tool that updates this flag it only runs on selected lines not on the entire dataset.
How can I make this portion of my script update lines anywhere in my network (whether selected or not) without changing the selection state of the currently selected records (needed for later in the script)?
I thought maybe I could do this with
Make Feature Layer however this also uses just the currently selected features.
The only two ways I've come up with so far are:
- to store the selection from the
FIDset, clear the selection, make the modification, then re-select
- Duplicate the layer in ArcMap and have the script reference both
Neither of these are optimal, and I think things would work better if I could just specify somehow (env setting maybe?) for arcpy to honour or ignore the selection set.