How to get the selected layers in the TOC (i.e. clicked via the mouse and is now highlighted) with arcpy? thank you.
there is no arcpy functionality to do this
You could check them (uncheck the others you don't want) and then use the lyr.visible property to separate them.
aprx = arcpy.mp.ArcGISProject(r'C:\.aprx') m = aprx.listMaps("Map")[0] checked_layers = [lyr for lyr in m.listLayers() if lyr.visible] #for lyr in m.listLayers(): # if lyr.visible: # arcpy.AddMessage(f"{lyr.name} is selected.")
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.