Skip to content

Instantly share code, notes, and snippets.

@nmpeterson
Last active January 13, 2023 18:23
Show Gist options
  • Save nmpeterson/6117049 to your computer and use it in GitHub Desktop.
Save nmpeterson/6117049 to your computer and use it in GitHub Desktop.
An arcpy-dependent function for checking whether any features are currently selected in the specified feature layer or table view.
#import arcpy
def check_selection(lyr):
"""Check whether specified feature layer has a selection."""
desc = arcpy.Describe(lyr)
selected = desc.FIDSet
return len(selected) > 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment