Select to view content in your preferred language

Invert method problem

556
2
Jump to solution
02-05-2013 03:10 PM
babakkasraei
Emerging Contributor
Hi Experts

I try to write some codes to hide unselected features in my map. I have written some part of it. The first part of the codes must find selected features. This part works as follows.

 def button3Click(self, selection):         index = self.listbox.curselection()                        label = self.listbox.get(index)           # Local variables:         layer = label          # describe the feature layer to access the the selected set         desc = arcpy.Describe(layer)          # FIDSet will contain the selected features         selectedFids = desc.FIDSet                   # If there are selectedFids (a selection set), write them to a new feature         # class in the current workspace.         if len(selectedFids) > 0:


In the other part I need to invert to find those features which are unselected. The method that I write for it doesn't work.

                       queryList = selectedFids.replace(';', ',') 


Would you help me with this method.

Best regards

Babak
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
MathewCoyle
Honored Contributor
Use SWITCH_SELECTION as the selection type parameter.

arcpy.SelectLayerByAttribute_management(layer, "SWITCH_SELECTION")


http://resources.arcgis.com/en/help/main/10.1/index.html#//001700000071000000

View solution in original post

0 Kudos
2 Replies
MathewCoyle
Honored Contributor
Use SWITCH_SELECTION as the selection type parameter.

arcpy.SelectLayerByAttribute_management(layer, "SWITCH_SELECTION")


http://resources.arcgis.com/en/help/main/10.1/index.html#//001700000071000000
0 Kudos
babakkasraei
Emerging Contributor
Thank you Mathew

Great help.

Best regards

Babak
0 Kudos