I'm trying to get the id's of polygons that I select with a Python addin tool, but it is returning all the features, no just my selection. Any ideas?import arcpy import pythonaddins global coords, mxd, df, ids coords = [] ids = [] mxdPath = r'E:\gis\Atlas\Atlas.mxd' mxd = arcpy.mapping.MapDocument(mxdPath) class DrawPolygon(object): """Implementation for searchAtlas_addin.drawPolygonTl (Tool)""" def __init__(self): self.enabled = True self.shape = "Line" def onLine(self, line_geometry): array = arcpy.Array() part = line_geometry.getPart(0) for pt in part: array.add(pt) polygon = arcpy.Polygon(array) getBlockIDs(polygon) def getBlockIDs(inPolygon): print 'getting block ids' fc = r'E:\gis\Atlas\default.gdb\blocks' arcpy.MakeFeatureLayer_management(fc, 'blocksLyr') arcpy.MakeFeatureLayer_management(inPolygon, 'aoiLyr') arcpy.SelectLayerByLocation_management('blocksLyr', 'INTERSECT', 'aoiLyr') with arcpy.da.SearchCursor(fc, 'BlockNumber') as c: for r in c: ids.append(r[0]) print ids