AnsweredAssumed Answered

How do List and get field values of Currently Selected Features in a layer

Question asked by gslim on Oct 24, 2013
Latest reply on Oct 25, 2013 by gslim
I have an add in that selects all the points of a specific layer within the currently zoomed in extents on a button click event.  Now I need to populate a combo box with the label field of all these features.  Does anybody know of a way to do this?  The search cursor wants the dataset which will not get just the currently selected.

Thanks for your time.

def onClick(self):         self.mxd = arcpy.mapping.MapDocument('current')         layers = arcpy.mapping.ListLayers(self.mxd)         self.items = []         for layer in layers:             if == "hydrantm":                 hydLayer = layer         print hydLayer         df = arcpy.mapping.ListDataFrames(self.mxd)[0]         extent = str(df.extent)         print extent         dfAsFeature = arcpy.Polygon(arcpy.Array([df.extent.lowerLeft, df.extent.lowerRight, df.extent.upperRight, df.extent.upperLeft]),                             df.spatialReference)         arcpy.SelectLayerByLocation_management(hydLayer, "INTERSECT", dfAsFeature, "", "NEW_SELECTION")