<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: get list of highlighted features within a selection in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/get-list-of-highlighted-features-within-a/m-p/189475#M14549</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;2 diffrent solutions for only selected features but not the highlighted ones : &lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Import arcpy module
import arcpy

#Layer that have already a selection ans some feature highlighted :
layerName = "PARCELS"

# first way to count selected features
rows = arcpy.SearchCursor(layerName)
i = 0
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; i=i+1

# second way to count selected features
d = arcpy.Describe(layerName)
fids = d.FIDSet

#print results : 
arcpy.AddMessage("loop count : " + str(i)) 
arcpy.AddMessage("desc count : " + str(len(fids.split(";"))))&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;But I need to get only the highlighted ones ...&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Doing this through programming has no interfaces in .Net, and therefore it would be impossible with Python.&amp;nbsp; Python only provides interfaces to a relatively small set of common map manipulations compared to .Net.&amp;nbsp; But even for .Net there does not seem to be a direct way of working with any kind of highlighted records interface, class or method.&amp;nbsp; The only .Net Interface I have seen to control the actual Table View window seen by the user in Desktop (&lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#//000v00000196000000" rel="nofollow noopener noreferrer" target="_blank"&gt;ITableWindow3&lt;/A&gt;&lt;SPAN&gt;) has a toggle status property to change whether or not only selected records are shown (&lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#//000v00000191000000" rel="nofollow noopener noreferrer" target="_blank"&gt;ShowSelected&lt;/A&gt;&lt;SPAN&gt;).&amp;nbsp; But it also says it only supports a &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#//000v0000019q000000" rel="nofollow noopener noreferrer" target="_blank"&gt;SelectionSet&lt;/A&gt;&lt;SPAN&gt; when all rows are shown (making highlighted selections impossible).&amp;nbsp; So you can detect when the window is only showing selected records, but to do anything with the selection you have to toggle out of that display to show all records.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The only code I found that seemed to deal with it at all (in .Net) is in &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/41936-select-from-selected" rel="nofollow noopener noreferrer" target="_blank"&gt;this post&lt;/A&gt;&lt;SPAN&gt;.&amp;nbsp; But it seems like the programmer would have to create and manage every highlight behavior if this is the only code that works and it seems this is not using the built in highlighting behaviors at all.&amp;nbsp; Perhaps ESRI programmers have access to interfaces that they are not exposing to end users.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyway, if .Net does not have any well defined interface to work with highlighted records in the Desktop Table Window the user sees, Python definitely won't.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 09:32:50 GMT</pubDate>
    <dc:creator>RichardFairhurst</dc:creator>
    <dc:date>2021-12-11T09:32:50Z</dc:date>
    <item>
      <title>get list of highlighted features within a selection</title>
      <link>https://community.esri.com/t5/python-questions/get-list-of-highlighted-features-within-a/m-p/189472#M14546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;from arcpy (in arcmap) i can get all selected feature within a layer using : &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;rows = arcpy.SearchCursor("myLayerNBame")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But it will list all selected feature that appear (in blue in the attribute table).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I need to get only the features that are highlighted in the selection (in yellow in the attribute table).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Does arcpy offers a solution for this ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Mar 2014 08:30:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/get-list-of-highlighted-features-within-a/m-p/189472#M14546</guid>
      <dc:creator>GuillaumeMOCCAND</dc:creator>
      <dc:date>2014-03-14T08:30:20Z</dc:date>
    </item>
    <item>
      <title>Re: get list of highlighted features within a selection</title>
      <link>https://community.esri.com/t5/python-questions/get-list-of-highlighted-features-within-a/m-p/189473#M14547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Not sure this is possible but the following post has a way for getting the selected features.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/97774-arcpy-mapping-getting-the-selected-features-of-one-data-frame-selected-in-another-df"&gt;http://forums.arcgis.com/threads/97774-arcpy-mapping-getting-the-selected-features-of-one-data-frame-selected-in-another-df&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Your best bet is to select the layer by attributes with the options o select from current selection. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This will have the same results&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dave&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Mar 2014 15:06:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/get-list-of-highlighted-features-within-a/m-p/189473#M14547</guid>
      <dc:creator>DaveBarrett</dc:creator>
      <dc:date>2014-03-14T15:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: get list of highlighted features within a selection</title>
      <link>https://community.esri.com/t5/python-questions/get-list-of-highlighted-features-within-a/m-p/189474#M14548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;2 diffrent solutions for only selected features but not the highlighted ones : &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Import arcpy module
import arcpy

#Layer that have already a selection ans some feature highlighted :
layerName = "PARCELS"

# first way to count selected features
rows = arcpy.SearchCursor(layerName)
i = 0
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; i=i+1

# second way to count selected features
d = arcpy.Describe(layerName)
fids = d.FIDSet

#print results : 
arcpy.AddMessage("loop count : " + str(i)) 
arcpy.AddMessage("desc count : " + str(len(fids.split(";"))))&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But I need to get only the highlighted ones ...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:32:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/get-list-of-highlighted-features-within-a/m-p/189474#M14548</guid>
      <dc:creator>GuillaumeMOCCAND</dc:creator>
      <dc:date>2021-12-11T09:32:47Z</dc:date>
    </item>
    <item>
      <title>Re: get list of highlighted features within a selection</title>
      <link>https://community.esri.com/t5/python-questions/get-list-of-highlighted-features-within-a/m-p/189475#M14549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;2 diffrent solutions for only selected features but not the highlighted ones : &lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;# Import arcpy module
import arcpy

#Layer that have already a selection ans some feature highlighted :
layerName = "PARCELS"

# first way to count selected features
rows = arcpy.SearchCursor(layerName)
i = 0
for row in rows:
&amp;nbsp;&amp;nbsp;&amp;nbsp; i=i+1

# second way to count selected features
d = arcpy.Describe(layerName)
fids = d.FIDSet

#print results : 
arcpy.AddMessage("loop count : " + str(i)) 
arcpy.AddMessage("desc count : " + str(len(fids.split(";"))))&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;But I need to get only the highlighted ones ...&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Doing this through programming has no interfaces in .Net, and therefore it would be impossible with Python.&amp;nbsp; Python only provides interfaces to a relatively small set of common map manipulations compared to .Net.&amp;nbsp; But even for .Net there does not seem to be a direct way of working with any kind of highlighted records interface, class or method.&amp;nbsp; The only .Net Interface I have seen to control the actual Table View window seen by the user in Desktop (&lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#//000v00000196000000" rel="nofollow noopener noreferrer" target="_blank"&gt;ITableWindow3&lt;/A&gt;&lt;SPAN&gt;) has a toggle status property to change whether or not only selected records are shown (&lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#//000v00000191000000" rel="nofollow noopener noreferrer" target="_blank"&gt;ShowSelected&lt;/A&gt;&lt;SPAN&gt;).&amp;nbsp; But it also says it only supports a &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#//000v0000019q000000" rel="nofollow noopener noreferrer" target="_blank"&gt;SelectionSet&lt;/A&gt;&lt;SPAN&gt; when all rows are shown (making highlighted selections impossible).&amp;nbsp; So you can detect when the window is only showing selected records, but to do anything with the selection you have to toggle out of that display to show all records.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The only code I found that seemed to deal with it at all (in .Net) is in &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/41936-select-from-selected" rel="nofollow noopener noreferrer" target="_blank"&gt;this post&lt;/A&gt;&lt;SPAN&gt;.&amp;nbsp; But it seems like the programmer would have to create and manage every highlight behavior if this is the only code that works and it seems this is not using the built in highlighting behaviors at all.&amp;nbsp; Perhaps ESRI programmers have access to interfaces that they are not exposing to end users.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyway, if .Net does not have any well defined interface to work with highlighted records in the Desktop Table Window the user sees, Python definitely won't.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:32:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/get-list-of-highlighted-features-within-a/m-p/189475#M14549</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-11T09:32:50Z</dc:date>
    </item>
  </channel>
</rss>

