<?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: Check that features have been selected in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/check-that-features-have-been-selected/m-p/434631#M34158</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Your selection is on a layer, right? if so then use FIDSet as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;dsc = arcpy.Describe("LayerName")

selection_set = dsc.FIDSet
if len(selection_set) == 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp; # no feature is selected
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 19:28:51 GMT</pubDate>
    <dc:creator>NobbirAhmed</dc:creator>
    <dc:date>2021-12-11T19:28:51Z</dc:date>
    <item>
      <title>Check that features have been selected</title>
      <link>https://community.esri.com/t5/python-questions/check-that-features-have-been-selected/m-p/434629#M34156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can one check if any features have been selected in a Python script?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to check if any features have been selected prior to running the script. Otherwise, the script would try to process all the records in a feature class. Thus, if no features are selected, the script would tell the user to select some features and then exit the script. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your help, Brian&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2012 13:48:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/check-that-features-have-been-selected/m-p/434629#M34156</guid>
      <dc:creator>BrianPangtay</dc:creator>
      <dc:date>2012-05-24T13:48:49Z</dc:date>
    </item>
    <item>
      <title>Re: Check that features have been selected</title>
      <link>https://community.esri.com/t5/python-questions/check-that-features-have-been-selected/m-p/434630#M34157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;One method I've used in the past is to compare the number of features in the input layer (arcpy.GetCount_management) with the number in the layer's source data (arcpy.describe::CatalogPath). If they are the same, nothing has been selected.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2012 14:00:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/check-that-features-have-been-selected/m-p/434630#M34157</guid>
      <dc:creator>BruceNielsen</dc:creator>
      <dc:date>2012-05-24T14:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: Check that features have been selected</title>
      <link>https://community.esri.com/t5/python-questions/check-that-features-have-been-selected/m-p/434631#M34158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Your selection is on a layer, right? if so then use FIDSet as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;dsc = arcpy.Describe("LayerName")

selection_set = dsc.FIDSet
if len(selection_set) == 0:
&amp;nbsp;&amp;nbsp;&amp;nbsp; # no feature is selected
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 19:28:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/check-that-features-have-been-selected/m-p/434631#M34158</guid>
      <dc:creator>NobbirAhmed</dc:creator>
      <dc:date>2021-12-11T19:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: Check that features have been selected</title>
      <link>https://community.esri.com/t5/python-questions/check-that-features-have-been-selected/m-p/434632#M34159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How do you write this same code in 9.3.1?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jun 2012 18:36:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/check-that-features-have-been-selected/m-p/434632#M34159</guid>
      <dc:creator>JoseSanchez</dc:creator>
      <dc:date>2012-06-22T18:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: Check that features have been selected</title>
      <link>https://community.esri.com/t5/python-questions/check-that-features-have-been-selected/m-p/434633#M34160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think it is the same for 9.3 as well. Follow this link - you will see FIDSet property on a described object for a layer:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=Layer_properties"&gt;http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=Layer_properties&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jun 2012 19:16:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/check-that-features-have-been-selected/m-p/434633#M34160</guid>
      <dc:creator>NobbirAhmed</dc:creator>
      <dc:date>2012-06-22T19:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: Check that features have been selected</title>
      <link>https://community.esri.com/t5/python-questions/check-that-features-have-been-selected/m-p/434634#M34161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I found that this worked for me:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;layers = arcpy.mapping.ListLayers(mxd)&lt;/P&gt;&lt;P&gt;for layer in layers:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; desc = arcpy.Describe(layer)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; selcount = desc.fidSet&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if layer.name == "san_Wye":&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print layer.name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if selcount &amp;lt;&amp;gt; "":&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "{0} features selected".format(len(desc.fidSet.split(';')))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if selcount == "":&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "no features selected"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Aug 2014 18:59:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/check-that-features-have-been-selected/m-p/434634#M34161</guid>
      <dc:creator>deleted-user-8KkqhMYcTNGx</dc:creator>
      <dc:date>2014-08-04T18:59:20Z</dc:date>
    </item>
  </channel>
</rss>

