<?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: arcpy visible not working in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220448#M17020</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hello Zack,&lt;BR /&gt;&lt;BR /&gt;I have a few quick questions/suggestions.&lt;BR /&gt;1) Are all the layers in the same extent? Or should you be zooming to the layers before exporting? (see &lt;A href="http://forums.arcgis.com/threads/78098-Is-there-a-Zoom-to-Layer-command-in-Python"&gt;here&lt;/A&gt;)&lt;BR /&gt;2) Do you have multiple dataframes? If so, make sure the right one is active. (you can use this: &lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;mxd.activeView = df.name&lt;/SPAN&gt;)&lt;BR /&gt;3) Sometimes an active refresh helps (&lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;arcpy.RefreshActiveView()&lt;/SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;Good luck!&lt;BR /&gt;~Josh&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Josh, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your suggestions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. The layers cover close to the same extent. It isn't a matter of my data frame being in the wrong place. In fact, I have a simple base layer turned on in the MXD, and that exports fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2. The MXD contains only one dataframe.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3. The RefreshActiveView didn't make a difference.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 Feb 2014 14:16:17 GMT</pubDate>
    <dc:creator>ZackBartlett</dc:creator>
    <dc:date>2014-02-04T14:16:17Z</dc:date>
    <item>
      <title>arcpy visible not working</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220442#M17014</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have&amp;nbsp; a script that adds .lyr files to an MXD.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A loop then iterates through the layers in the MXD and turns them all OFF, using the lyr.visible = False function. This part of my code works.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I then want to iterate through the list again, turn on the first layer, export the map as a PDF, turn off the layer, then move onto the next layer. This is the part that doesn't work. The layers do not turn on again. The PDFs export, but they are all blank.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've seen this question asked before, but the solutions listed don't seem to be working for me. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've posted the code below.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;LYR_list_MXD = arcpy.mapping.ListLayers(MXD,"*_env*",DF)&amp;nbsp; for LYR in LYR_list_MXD: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LYR.visible = False&amp;nbsp; MXD.save()&amp;nbsp; # Turn on each layer individually and export map as new PDF&amp;nbsp; for LYR in LYR_list_MXD: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LYR.visible = True &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output_PDF = OutputPDFFolder + "\\" + str(LYR) + ".pdf" &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportToPDF(MXD, output_PDF) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LYR.visible = False &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MXD.save()&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions would be greatly appreciated.&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;-Zack&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2014 13:09:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220442#M17014</guid>
      <dc:creator>ZackBartlett</dc:creator>
      <dc:date>2014-02-04T13:09:37Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy visible not working</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220443#M17015</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Zack:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Might you need to re-populate LYR_list_MXD by running the line:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LYR_list_MXD = arcpy.mapping.ListLayers(MXD,"*_env*",DF)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;again, after you saved the file.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2014 13:17:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220443#M17015</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2014-02-04T13:17:45Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy visible not working</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220444#M17016</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Michael, but that didn't do the trick either. Still getting blank PDFs.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2014 13:34:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220444#M17016</guid>
      <dc:creator>ZackBartlett</dc:creator>
      <dc:date>2014-02-04T13:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy visible not working</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220445#M17017</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can you try printing out the lyr name in the list to make sure it is getting populated correctly in your second loop?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2014 14:00:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220445#M17017</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2014-02-04T14:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy visible not working</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220446#M17018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Zack,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a few quick questions/suggestions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1) Are all the layers in the same extent? Or should you be zooming to the layers before exporting? (see &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/78098-Is-there-a-Zoom-to-Layer-command-in-Python"&gt;here&lt;/A&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) Do you have multiple dataframes? If so, make sure the right one is active. (you can use this: &lt;/SPAN&gt;&lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;mxd.activeView = df.name&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3) Sometimes an active refresh helps (&lt;/SPAN&gt;&lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;arcpy.RefreshActiveView()&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good luck!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;~Josh&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2014 14:06:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220446#M17018</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2014-02-04T14:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy visible not working</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220447#M17019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Can you try printing out the lyr name in the list to make sure it is getting populated correctly in your second loop?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried adding a print LYR command. It works as it should.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2014 14:13:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220447#M17019</guid>
      <dc:creator>ZackBartlett</dc:creator>
      <dc:date>2014-02-04T14:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy visible not working</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220448#M17020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hello Zack,&lt;BR /&gt;&lt;BR /&gt;I have a few quick questions/suggestions.&lt;BR /&gt;1) Are all the layers in the same extent? Or should you be zooming to the layers before exporting? (see &lt;A href="http://forums.arcgis.com/threads/78098-Is-there-a-Zoom-to-Layer-command-in-Python"&gt;here&lt;/A&gt;)&lt;BR /&gt;2) Do you have multiple dataframes? If so, make sure the right one is active. (you can use this: &lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;mxd.activeView = df.name&lt;/SPAN&gt;)&lt;BR /&gt;3) Sometimes an active refresh helps (&lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;arcpy.RefreshActiveView()&lt;/SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;Good luck!&lt;BR /&gt;~Josh&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Josh, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your suggestions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. The layers cover close to the same extent. It isn't a matter of my data frame being in the wrong place. In fact, I have a simple base layer turned on in the MXD, and that exports fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2. The MXD contains only one dataframe.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3. The RefreshActiveView didn't make a difference.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2014 14:16:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220448#M17020</guid>
      <dc:creator>ZackBartlett</dc:creator>
      <dc:date>2014-02-04T14:16:17Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy visible not working</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220449#M17021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I made a few additions to the script based on some of your suggestions to see if things were working properly. It only served to confuse me more. See below.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;LYR_list_MXD = arcpy.mapping.ListLayers(MXD,"*_env*",DF)

for LYR in LYR_list_MXD:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LYR.visible = False

MXD.save()

# Turn on each layer individualy and export map as new PDF

for LYR in LYR_list_MXD:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "1." + str(LYR)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "2." + str(LYR.visible)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LYR.visible = True
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "3." + str(LYR.visible)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MXD.save()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output_PDF = OutputPDFFolder + "\\" + str(LYR) + ".pdf"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportToPDF(MXD, output_PDF)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "4." + str(LYR.visible)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LYR.visible = False
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "5." + str(LYR.visible)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.RefreshActiveView()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MXD.save()&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As you can see, I have a few print functions in my second for loop. My output is as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1.merge_tdiss_final_buff_env.lyr&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2.False&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3.True&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4.True&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;5.False&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This, of course, repeats for every item in LYR_list_MXD, but I just copied a single one.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- It prints the layer name correctly. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- It prints that the layer isn't visible (as I turned them all off in my first for loop).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- I then turn the layer on and print to make sure it is visible, and it is.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- I then save, refresh, export the map&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- print to see if it's still visible&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- Turn the layer off, refresh, and save.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But my PDFs are still blank.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:12:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220449#M17021</guid>
      <dc:creator>ZackBartlett</dc:creator>
      <dc:date>2021-12-12T16:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy visible not working</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220450#M17022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If it's any consolation, your script is working well on my machine (produces the correct non-blank PDFs).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have you triple checked your mxd to make sure the extent is in right spot (in layout view)?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2014 15:13:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220450#M17022</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2014-02-04T15:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy visible not working</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220451#M17023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What version of ArcMap is installed on the machine where it is working correctly?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What version of ArcMap is installed on the machine where it is not working correctly?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2014 15:19:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220451#M17023</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2014-02-04T15:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy visible not working</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220452#M17024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;What version of ArcMap is installed on the machine where it is working correctly?&lt;BR /&gt;&lt;BR /&gt;What version of ArcMap is installed on the machine where it is not working correctly?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Non-working machine: 10.1, with SP1.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2014 15:29:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220452#M17024</guid>
      <dc:creator>ZackBartlett</dc:creator>
      <dc:date>2014-02-04T15:29:14Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy visible not working</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220453#M17025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Working machine: 10.1, with SP0.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note: I did remove the MXD.save() lines, but that shouldn't make a difference.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2014 16:23:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220453#M17025</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2014-02-04T16:23:26Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy visible not working</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220454#M17026</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;UPDATE:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I opened my MXD and ran the code below 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; import arcpy
&amp;gt;&amp;gt;&amp;gt; MXD = arcpy.mapping.MapDocument("CURRENT")
&amp;gt;&amp;gt;&amp;gt; DF = arcpy.mapping.ListDataFrames(MXD, "Layers")[0]
&amp;gt;&amp;gt;&amp;gt; LYR_list = arcpy.mapping.ListLayers(MXD, "*_env*",DF)
&amp;gt;&amp;gt;&amp;gt; for lyr in LYR_list:
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.visible = True
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output_PDF = r"T:\JOBS\123110494\gis_data\spatial_data\project_discipline\modeling\scripts\ZB\PDF\\" + str(lyr) + ".pdf"
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportToPDF(MXD, output_PDF)
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.visible = False
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MXD.save()
...&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This time it worked fine. All my PDFs were exported showing the correct layer.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:45:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220454#M17026</guid>
      <dc:creator>ZackBartlett</dc:creator>
      <dc:date>2021-12-11T10:45:13Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy visible not working</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220455#M17027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; Working machine: 10.1, with SP0.&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt; &lt;SPAN style="color:&amp;quot;#696969&amp;quot;;"&gt;Note: I did remove the &lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;MXD.save()&lt;/SPAN&gt; lines, but that shouldn't make a difference.&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Joshua, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Turns out it does make a difference!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried running the script with only a single MXD.save() in my code, right at the end, outside of all for loops, and it worked!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have no idea why, but if you or anyone else out there knows why this would happen, I'd love to know the answer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks, Joshua, you solved this one without even knowing it!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Zack&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2014 16:37:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220455#M17027</guid>
      <dc:creator>ZackBartlett</dc:creator>
      <dc:date>2014-02-04T16:37:22Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy visible not working</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220456#M17028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Geez, sorry. I should have mentioned that to start with.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'd also be very interested to know why that made a difference.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm happy it worked out for you!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2014 16:45:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220456#M17028</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2014-02-04T16:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy visible not working</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220457#M17029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Joshua, &lt;BR /&gt;&lt;BR /&gt;I tried running the script with only a single MXD.save() in my code, right at the end, outside of all for loops, and it worked!&lt;BR /&gt;&lt;BR /&gt;-Zack&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wow, I wouldn't have expected that! But now that you mention it, it seems like every time you use MXD.save() the changes to the MXD get lost in limbo until you delete the MXD object.&amp;nbsp; But that means you need to re-open the MXD again, which isn't ideal and your code would then look something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
MXD = arcpy.mapping.MapDocument(MXD_file)
DF = arcpy.mapping.ListDataFrames(MXD)[0]
LYR_list_MXD = arcpy.mapping.ListLayers(MXD,"*_env*",DF)
LYR_count = len(LYR_list_MXD)
for LYR in LYR_list_MXD:
&amp;nbsp;&amp;nbsp;&amp;nbsp; LYR.visible = False

MXD.save()
del MXD

# Turn on each layer individually and export map as new PDF

for i in range(LYR_count):
&amp;nbsp;&amp;nbsp;&amp;nbsp; # now you need to reopen the MXD...
&amp;nbsp;&amp;nbsp;&amp;nbsp; MXD = arcpy.mapping.MapDocument(MXD_file)
&amp;nbsp;&amp;nbsp;&amp;nbsp; DF = arcpy.mapping.ListDataFrames(MXD)[0]
&amp;nbsp;&amp;nbsp;&amp;nbsp; LYR = arcpy.mapping.ListLayers(MXD,"*_env*",DF)&lt;I&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; LYR.visible = True
&amp;nbsp;&amp;nbsp;&amp;nbsp; output_PDF = OutputPDFFolder + "\\" + str(LYR) + ".pdf"
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.ExportToPDF(MXD, output_PDF)
&amp;nbsp;&amp;nbsp;&amp;nbsp; LYR.visible = False
&amp;nbsp;&amp;nbsp;&amp;nbsp; MXD.save()
&amp;nbsp;&amp;nbsp;&amp;nbsp; del MXD
&lt;/I&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note I've only tested this when running a script outside of ArcMap and not using "CURRENT" as your map document.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:45:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-visible-not-working/m-p/220457#M17029</guid>
      <dc:creator>BradPosthumus</dc:creator>
      <dc:date>2021-12-11T10:45:16Z</dc:date>
    </item>
  </channel>
</rss>

