<?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: Making layers persist in TOC after python toolbox execution completes in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/making-layers-persist-in-toc-after-python-toolbox/m-p/580408#M45519</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have the same problem, could you solve it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 Sep 2020 08:49:04 GMT</pubDate>
    <dc:creator>SilviaP</dc:creator>
    <dc:date>2020-09-15T08:49:04Z</dc:date>
    <item>
      <title>Making layers persist in TOC after python toolbox execution completes</title>
      <link>https://community.esri.com/t5/python-questions/making-layers-persist-in-toc-after-python-toolbox/m-p/580405#M45516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am on ArcGIS 10.1 SP1 (Build 3143)&lt;/P&gt;&lt;P&gt;I have a python toolbox that is producing a number of shapefile outputs that I would like to add to the ArcGIS TOC.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Problem I am having is that whilst the layers add to the TOC while the tool is running when it completes the layers are deleted, and I can't seem to find a way to avoid this.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anybody have any ideas? My code (pretty standard) is below:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;mxd = arcpy.mapping.MapDocument(&lt;SPAN style="; color: #00aa00; font-size: 10pt;"&gt;&lt;EM&gt;"CURRENT"&lt;/EM&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;df&amp;nbsp; = arcpy.mapping.ListDataFrames(mxd.&lt;SPAN style="; color: #00aa00; font-size: 10pt;"&gt;&lt;EM&gt;"*"&lt;/EM&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;)[&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 10pt;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;]&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;addLayer = arcpy.mapping.Layer(outputFeatureclass) &lt;/P&gt;&lt;P&gt;arcpy.mapping.AddLayer(df, addLayer,&lt;SPAN style="; color: #00aa00; font-size: 10pt;"&gt;&lt;EM&gt;"BOTTOM"&lt;/EM&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;)&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;arcpy.RefreshTOC() &lt;/P&gt;&lt;P&gt;arcpy.RefreshActiveView()&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Thanks for any help!&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Steve&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2014 12:44:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/making-layers-persist-in-toc-after-python-toolbox/m-p/580405#M45516</guid>
      <dc:creator>stevenbosher</dc:creator>
      <dc:date>2014-11-14T12:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: Making layers persist in TOC after python toolbox execution completes</title>
      <link>https://community.esri.com/t5/python-questions/making-layers-persist-in-toc-after-python-toolbox/m-p/580406#M45517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;mxd.save()&lt;/P&gt;&lt;P&gt;and make sure that you haven't set your geoprocessing options to have results temporary by default&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2014 14:04:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/making-layers-persist-in-toc-after-python-toolbox/m-p/580406#M45517</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-11-14T14:04:21Z</dc:date>
    </item>
    <item>
      <title>Re: Making layers persist in TOC after python toolbox execution completes</title>
      <link>https://community.esri.com/t5/python-questions/making-layers-persist-in-toc-after-python-toolbox/m-p/580407#M45518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Dan for your response.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunatly none of these work for me..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2014 14:32:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/making-layers-persist-in-toc-after-python-toolbox/m-p/580407#M45518</guid>
      <dc:creator>stevenbosher</dc:creator>
      <dc:date>2014-11-14T14:32:47Z</dc:date>
    </item>
    <item>
      <title>Re: Making layers persist in TOC after python toolbox execution completes</title>
      <link>https://community.esri.com/t5/python-questions/making-layers-persist-in-toc-after-python-toolbox/m-p/580408#M45519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have the same problem, could you solve it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Sep 2020 08:49:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/making-layers-persist-in-toc-after-python-toolbox/m-p/580408#M45519</guid>
      <dc:creator>SilviaP</dc:creator>
      <dc:date>2020-09-15T08:49:04Z</dc:date>
    </item>
  </channel>
</rss>

