<?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 Fnd the selected layer in the ArcMap Table Of Contents in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/fnd-the-selected-layer-in-the-arcmap-table-of/m-p/171517#M13189</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is there an ArcPy equivalent to IMXDocument::SelectedItem to get the selected layer in the ArcMap Table of Contents?...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pMxDoc As IMxDocument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pLayer As ILayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pMxDoc = ThisDocument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pLayer = pMxDoc.SelectedItem&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 May 2012 17:32:51 GMT</pubDate>
    <dc:creator>PeterHewetson</dc:creator>
    <dc:date>2012-05-09T17:32:51Z</dc:date>
    <item>
      <title>Fnd the selected layer in the ArcMap Table Of Contents</title>
      <link>https://community.esri.com/t5/python-questions/fnd-the-selected-layer-in-the-arcmap-table-of/m-p/171517#M13189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is there an ArcPy equivalent to IMXDocument::SelectedItem to get the selected layer in the ArcMap Table of Contents?...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pMxDoc As IMxDocument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim pLayer As ILayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pMxDoc = ThisDocument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set pLayer = pMxDoc.SelectedItem&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 May 2012 17:32:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/fnd-the-selected-layer-in-the-arcmap-table-of/m-p/171517#M13189</guid>
      <dc:creator>PeterHewetson</dc:creator>
      <dc:date>2012-05-09T17:32:51Z</dc:date>
    </item>
    <item>
      <title>Re: Fnd the selected layer in the ArcMap Table Of Contents</title>
      <link>https://community.esri.com/t5/python-questions/fnd-the-selected-layer-in-the-arcmap-table-of/m-p/171518#M13190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;now is this something where you know which layer is to be selected, or you're trying to figure it out?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you already know the layers in the TofC, you can list them using the following in the python window&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[HTML]mxd = arcpy.mapping.MapDocument("insert path to mxd here, or if within arcmap use "CURRENT" ")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.mapping.Listayers(mxd)[/HTML]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That will get you all of the layers in the TOC.&amp;nbsp; If it's more than that, then I don't think I'm quite clear on what you're looking for.&amp;nbsp; I'm not a VB guy, so I don't know what &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;IMXDocument::SelectedItem&lt;/SPAN&gt;&lt;SPAN&gt; actually means.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 May 2012 18:03:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/fnd-the-selected-layer-in-the-arcmap-table-of/m-p/171518#M13190</guid>
      <dc:creator>StephenKruzik</dc:creator>
      <dc:date>2012-05-09T18:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: Fnd the selected layer in the ArcMap Table Of Contents</title>
      <link>https://community.esri.com/t5/python-questions/fnd-the-selected-layer-in-the-arcmap-table-of/m-p/171519#M13191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;now is this something where you know which layer is to be selected, or you're trying to figure it out?&lt;BR /&gt;&lt;BR /&gt;If you already know the layers in the TofC, you can list them using the following in the python window&lt;BR /&gt;&lt;BR /&gt;[HTML]mxd = arcpy.mapping.MapDocument("insert path to mxd here, or if within arcmap use "CURRENT" ")&lt;BR /&gt;arcpy.mapping.Listayers(mxd)[/HTML]&lt;BR /&gt;&lt;BR /&gt;That will get you all of the layers in the TOC.&amp;nbsp; If it's more than that, then I don't think I'm quite clear on what you're looking for.&amp;nbsp; I'm not a VB guy, so I don't know what &lt;SPAN style="font-style:italic;"&gt;IMXDocument::SelectedItem&lt;/SPAN&gt; actually means.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, that will return a list of all the map layers.&amp;nbsp; I was wondering if there was a way to reduce that list to just those layers selected by the user in the ArcMap TOC.&amp;nbsp; It would allow a quick method of inputing a particular layer(s) into a script.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 May 2012 12:39:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/fnd-the-selected-layer-in-the-arcmap-table-of/m-p/171519#M13191</guid>
      <dc:creator>PeterHewetson</dc:creator>
      <dc:date>2012-05-10T12:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: Fnd the selected layer in the ArcMap Table Of Contents</title>
      <link>https://community.esri.com/t5/python-questions/fnd-the-selected-layer-in-the-arcmap-table-of/m-p/171520#M13192</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Not in 10.0. In 10.1, you can use &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://resourcesbeta.arcgis.com/en/help/main/10.1/index.html#//014p00000021000000" rel="nofollow" target="_blank"&gt;GetSelectedTOCLayerOrDataFrame&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 May 2012 14:18:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/fnd-the-selected-layer-in-the-arcmap-table-of/m-p/171520#M13192</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2012-05-10T14:18:26Z</dc:date>
    </item>
    <item>
      <title>Geometry-type of the selected layer in the ArcMap Table Of Contents</title>
      <link>https://community.esri.com/t5/python-questions/fnd-the-selected-layer-in-the-arcmap-table-of/m-p/171521#M13193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This hint was very helpful.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But what kind of object is delivered by the "GetSelectedTOCLayerOrDataFrame-method"? I want to implement a new python addin, that applies a given symbology-file (lyr) to the selected layer in the TOC. I generated 3 lyr-files, one for each geometry-type (point, line, polygon), that hold all symbols of hundreds of shape-files in our system. And here is my question:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;How can I get the &lt;/SPAN&gt;&lt;STRONG&gt;geometry-type&lt;/STRONG&gt;&lt;SPAN&gt; of the "&lt;/SPAN&gt;&lt;STRONG&gt;GetSelectedTOCLayerOrDataFrame-object&lt;/STRONG&gt;&lt;SPAN&gt;" in order to apply the right lyr-file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jul 2012 17:48:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/fnd-the-selected-layer-in-the-arcmap-table-of/m-p/171521#M13193</guid>
      <dc:creator>ThorstenDey</dc:creator>
      <dc:date>2012-07-11T17:48:57Z</dc:date>
    </item>
    <item>
      <title>Re: Fnd the selected layer in the ArcMap Table Of Contents</title>
      <link>https://community.esri.com/t5/python-questions/fnd-the-selected-layer-in-the-arcmap-table-of/m-p/171522#M13194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Have you tried arcpy.Describe?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The following was typed in the Python Window:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;gt;&amp;gt;&amp;gt;mxd = arcpy.mapping.MapDocument("current")
&amp;gt;&amp;gt;&amp;gt;lyr = arcpy.mapping.ListLayers(mxd)[0]
&amp;gt;&amp;gt;&amp;gt; desc = arcpy.Describe(lyr)
&amp;gt;&amp;gt;&amp;gt; print desc.shapeType
Point

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:53:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/fnd-the-selected-layer-in-the-arcmap-table-of/m-p/171522#M13194</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2021-12-11T08:53:13Z</dc:date>
    </item>
  </channel>
</rss>

