Highlight Selected feature

429
1
Jump to solution
04-09-2018 03:42 PM
MohammadrezaNikfal1
Occasional Contributor

I am trying to select some features by "SelectLayerByAttribute_management" like this:

flayer = arcpy.MakeFeatureLayer_management(r"D:\LAKES.shp", "myLayer")
arcpy.SelectLayerByAttribute_management(flayer, "NEW_SELECTION", """"NAME" = 'Clarks Hill Lake'""")
cnt = arcpy.GetCount_management(flayer)
print cnt
arcpy.RefreshActiveView()

Everything is fine and cnt = 1, but in the map, it is not highlighted. How can highlight selected feature when you are running the arcpy script out of ArcGIS environment. 

0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

From you limited code, there is no reference to the active document.

http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-functions/refreshactiveview.htm

see if the addition of the appropriate lines in the code sample there help

View solution in original post

1 Reply
DanPatterson_Retired
MVP Emeritus

From you limited code, there is no reference to the active document.

http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-functions/refreshactiveview.htm

see if the addition of the appropriate lines in the code sample there help