<?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: Script Tool, Print Selected Features in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/script-tool-print-selected-features/m-p/1245068#M66387</link>
    <description>&lt;P&gt;I Intended to turn off the layer, my print needs the layer off but I still need the region of the layer area to print.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just need my print to target the "TCG4232_Grids" layer.&lt;/P&gt;</description>
    <pubDate>Tue, 03 Jan 2023 19:30:42 GMT</pubDate>
    <dc:creator>aecho2</dc:creator>
    <dc:date>2023-01-03T19:30:42Z</dc:date>
    <item>
      <title>Script Tool, Print Selected Features</title>
      <link>https://community.esri.com/t5/python-questions/script-tool-print-selected-features/m-p/1245019#M66385</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Need help printing only selected features in a layer, currently have the following:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy

#Set variables
arcpy.mp.ArcGISProject('CURRENT')
aprx = arcpy.mp.ArcGISProject('CURRENT')
TCG4232_USNG_GRIDS = "P:/PROJECTS/RP_Quality_Control_cGIS/MapSalesArcProProject/MapSalesLive1211/MapSalesLive/Data/GRIDS/USNG_GRID_OH.gdb"
Output_Folder = arcpy.GetParameterAsText(0)

#list of layer names that you want to be turned off.
p = arcpy.mp.ArcGISProject("Current")
m = p.listMaps("Map")[0]
layer_names = ['TCG4232_USNG_GRIDS']
lyrList = m.listLayers()
for lyr in lyrList:
    lyr.visible = True
    if lyr.name in layer_names:
        lyr.visible = False

#Print to PDF
try:
    aprx = arcpy.mp.ArcGISProject('CURRENT')
    l = aprx.listLayouts()[0]
    l.mapSeries.refresh()

    if l.mapSeries is not None:
        ms = l.mapSeries
        if ms.enabled:
            ms = l.mapSeries
            indexLyr = "TCG4232_USNG_GRIDS"
            ms.exportToPDF(Output_Folder,"SELECTED",
                "",
                "PDF_SINGLE_FILE",
                150,
                "FASTEST",
                True,
                "ADAPTIVE",
                True,
                "LAYERS_ONLY",
                True,
                80,
                True,
                False)
except Exception as e:
    print(f"Error: {e.args[0]}")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2023 18:39:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-tool-print-selected-features/m-p/1245019#M66385</guid>
      <dc:creator>aecho2</dc:creator>
      <dc:date>2023-01-03T18:39:32Z</dc:date>
    </item>
    <item>
      <title>Re: Script Tool, Print Selected Features</title>
      <link>https://community.esri.com/t5/python-questions/script-tool-print-selected-features/m-p/1245062#M66386</link>
      <description>&lt;P&gt;the lyr.visible turns the layer on/off only (either view all or none).&lt;/P&gt;&lt;P&gt;If you want to just display a subset of the data in a layer, you would put a &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/layer-class.htm" target="_self"&gt;definition query&lt;/A&gt; on the layer and have that layer as visible = True.&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2023 18:49:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-tool-print-selected-features/m-p/1245062#M66386</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2023-01-03T18:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: Script Tool, Print Selected Features</title>
      <link>https://community.esri.com/t5/python-questions/script-tool-print-selected-features/m-p/1245068#M66387</link>
      <description>&lt;P&gt;I Intended to turn off the layer, my print needs the layer off but I still need the region of the layer area to print.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just need my print to target the "TCG4232_Grids" layer.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2023 19:30:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-tool-print-selected-features/m-p/1245068#M66387</guid>
      <dc:creator>aecho2</dc:creator>
      <dc:date>2023-01-03T19:30:42Z</dc:date>
    </item>
  </channel>
</rss>

