arcpy.mapping: Determine if nothing is selected

383
1
Jump to solution
05-07-2013 12:01 PM
JamesCrandall
MVP Frequent Contributor
I just need to be able to determine if nothing is selected.  SearchCusors and GetCount_management only return either just the selected features or all of the features.

...pretty sure I am missing the obvious here.
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
JamesCrandall
MVP Frequent Contributor
...huh.  Seems like a get this great "GetCount" thingie, then I am expecting a similar method for zero selected features -- guess not.  This works but...  well, it works. (solution found 4 pages deep on a Google search!)


  for lyr in arcpy.mapping.ListLayers(mxd):     dsc = arcpy.Describe(lyr)     sel_set = dsc.FIDSet     if len(sel_set) == 0:         print "Nothing selected"     else:         'do all the stuff 

View solution in original post

0 Kudos
1 Reply
JamesCrandall
MVP Frequent Contributor
...huh.  Seems like a get this great "GetCount" thingie, then I am expecting a similar method for zero selected features -- guess not.  This works but...  well, it works. (solution found 4 pages deep on a Google search!)


  for lyr in arcpy.mapping.ListLayers(mxd):     dsc = arcpy.Describe(lyr)     sel_set = dsc.FIDSet     if len(sel_set) == 0:         print "Nothing selected"     else:         'do all the stuff 
0 Kudos