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.LYR_list_MXD = arcpy.mapping.ListLayers(MXD,"*_env*",DF)
for LYR in LYR_list_MXD:
LYR.visible = False
MXD.save()
# Turn on each layer individualy and export map as new PDF
for LYR in LYR_list_MXD:
print "1." + str(LYR)
print "2." + str(LYR.visible)
LYR.visible = True
print "3." + str(LYR.visible)
MXD.save()
arcpy.RefreshActiveView()
output_PDF = OutputPDFFolder + "\\" + str(LYR) + ".pdf"
arcpy.mapping.ExportToPDF(MXD, output_PDF)
print "4." + str(LYR.visible)
LYR.visible = False
print "5." + str(LYR.visible)
arcpy.RefreshActiveView()
MXD.save()
As you can see, I have a few print functions in my second for loop. My output is as follows:1.merge_tdiss_final_buff_env.lyr2.False3.True4.True5.FalseThis, of course, repeats for every item in LYR_list_MXD, but I just copied a single one.- It prints the layer name correctly. - It prints that the layer isn't visible (as I turned them all off in my first for loop).- I then turn the layer on and print to make sure it is visible, and it is.- I then save, refresh, export the map- print to see if it's still visible- Turn the layer off, refresh, and save.But my PDFs are still blank.