<?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>idea Layout Refresh method for arcpy.mp in ArcGIS Pro Ideas</title>
    <link>https://community.esri.com/t5/arcgis-pro-ideas/layout-refresh-method-for-arcpy-mp/idi-p/1508038</link>
    <description>&lt;P&gt;Currently there is no way to "refresh" a standard Layout object using the mp module. You can however refresh a mapseries.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy.mp as mp

# Current behavior for mapseries
project = mp.ArcGISProject("CURRENT")
layout = project.listLayouts()[0]
layout.mapSeries.refresh()

# Desired behavior for layouts
project = mp.ArcGISProject("CURRENT")
layout = project.listLayouts()[0]
layout.refresh()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 22 Jul 2024 19:22:13 GMT</pubDate>
    <dc:creator>HaydenWelch</dc:creator>
    <dc:date>2024-07-22T19:22:13Z</dc:date>
    <item>
      <title>Layout Refresh method for arcpy.mp</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/layout-refresh-method-for-arcpy-mp/idi-p/1508038</link>
      <description>&lt;P&gt;Currently there is no way to "refresh" a standard Layout object using the mp module. You can however refresh a mapseries.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy.mp as mp

# Current behavior for mapseries
project = mp.ArcGISProject("CURRENT")
layout = project.listLayouts()[0]
layout.mapSeries.refresh()

# Desired behavior for layouts
project = mp.ArcGISProject("CURRENT")
layout = project.listLayouts()[0]
layout.refresh()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2024 19:22:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/layout-refresh-method-for-arcpy-mp/idi-p/1508038</guid>
      <dc:creator>HaydenWelch</dc:creator>
      <dc:date>2024-07-22T19:22:13Z</dc:date>
    </item>
    <item>
      <title>Re: Layout Refresh method for arcpy.mp</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/layout-refresh-method-for-arcpy-mp/idc-p/1509316#M31128</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/607017"&gt;@HaydenWelch&lt;/a&gt;&amp;nbsp;, thanks for the feedback.&amp;nbsp; I'd like to know what type of layout elements are not updating for you.&amp;nbsp; Ideally, layouts should automatically refresh on their own without having force a refresh.&lt;/P&gt;&lt;P&gt;There are some core geoprocessing operations that may update data behind the scenes that doesn't trigger components in the app to refresh.&amp;nbsp; At Pro 3.3 the core Arcpy team introduced arcpy.RefreshLayer() that should trigger the appropriate updates in the App when data is being modified.&lt;/P&gt;&lt;P&gt;Another way to get the Layout to redraw is to use something like:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;p = arcpy.mp.ArcGISProject('current')
lyt = p.listLayouts('Some Layout')[0]
lyt_cim = lyt.getDefinition('V3')
lyt.setDefinition(lyt_cim)&lt;/LI-CODE&gt;&lt;P&gt;The code above forces the layout and its elements to redraw BUT DOES NOT force underlying data to update.&amp;nbsp; That is what&amp;nbsp;arcpy.RefreshLayer().&lt;/P&gt;&lt;P&gt;MapSeries.refresh() is for situations where data in the index layer has been updated.&amp;nbsp; Think of it as a specialized version of arcpy.RefreshLayer().&lt;/P&gt;&lt;P&gt;If this helps solve your issue, great, but if you there is a reason you really need to refresh a layout that is not data specific, please let us know.&lt;/P&gt;&lt;P&gt;Jeff - Layout and arcpy.mp teams&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2024 15:01:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/layout-refresh-method-for-arcpy-mp/idc-p/1509316#M31128</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2024-07-24T15:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: Layout Refresh method for arcpy.mp</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/layout-refresh-method-for-arcpy-mp/idc-p/1509348#M31130</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1134"&gt;@JeffBarrette&lt;/a&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Thanks for that code snippet! I always forget to dig into the CIM for doing layout stuff. It can get daunting. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;In my scenario the layouts tend to have multiple maps that they reference and getting the layout to update during an exportToPDF call needed to be done manually using the refresh button in the bottom right of the layout interface.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;I'm going to test out the forced CIM update to see if that works (it should), but I just noticed that there's not an intuitive way to "refresh" a layout that matches the functionality of the refresh button in the Layout interface in Pro&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2024 15:45:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/layout-refresh-method-for-arcpy-mp/idc-p/1509348#M31130</guid>
      <dc:creator>HaydenWelch</dc:creator>
      <dc:date>2024-07-24T15:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: Layout Refresh method for arcpy.mp</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/layout-refresh-method-for-arcpy-mp/idc-p/1509368#M31131</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/607017"&gt;@HaydenWelch&lt;/a&gt;&amp;nbsp;I completely understand your point of view.&amp;nbsp; Are you also saying that in the UI, you have to refresh to ensure you get the proper export?&amp;nbsp; That would definitely be a bug (the UI export or arcpy.mp export should always render proper output).&amp;nbsp; &amp;nbsp;Pro should automatically update and we purposely did not include a refresh option (like we had in ArcMap arcpy.mapping) because Pro's underlying architecture/services should do the automatic refresh. If they are not working, then we need to address that.&amp;nbsp; It might be possible to provide a refresh option but I want to make sure we are providing the correct solution.&amp;nbsp; Refresh my be a workaround but also an unnecessary step that will also be a performance hit.&lt;/P&gt;&lt;P&gt;I hope this make sense. If I could get some clarification on your workflow and possible repro steps, then we can make sure a proper fix/solution is provided.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2024 15:57:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/layout-refresh-method-for-arcpy-mp/idc-p/1509368#M31131</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2024-07-24T15:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: Layout Refresh method for arcpy.mp</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/layout-refresh-method-for-arcpy-mp/idc-p/1509451#M31145</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1134"&gt;@JeffBarrette&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Huh, I've definitely got an edge case here. I'm going to do some internal testing and get back to you if I find out what's causing the issue. I just tested it on some other templates and it works fine with the builtin refreshing. It could be that we've built some complex queries and calculations into some of the dynamic text and tables. The issue is also bad on layouts with large image files, but when testing in isolation the large images only caused the update to be delayed and not ignored.&lt;/P&gt;&lt;P&gt;Could a cache/memory limit be causing issues? say if 20+ layouts were all referencing the same queried layer with dynamic text functions?&lt;/P&gt;&lt;P&gt;For now though your solution of forcing a CIM update is working. It seems that the issue is primary with dynamic text objects not being auto refreshed on export and updating the CIM that way fixes it.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2024 00:27:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/layout-refresh-method-for-arcpy-mp/idc-p/1509451#M31145</guid>
      <dc:creator>HaydenWelch</dc:creator>
      <dc:date>2024-07-25T00:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: Layout Refresh method for arcpy.mp</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/layout-refresh-method-for-arcpy-mp/idc-p/1555630#M32671</link>
      <description>&lt;P&gt;For me it is changing the text in a text element.&amp;nbsp; I have it set to Align Center in the Layout but if a change the text out in script it does not recenter at all so it looks terrible.&amp;nbsp; What is the point of being able to change the text if it does not realign?&amp;nbsp; I must be missing something.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Nov 2024 22:32:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/layout-refresh-method-for-arcpy-mp/idc-p/1555630#M32671</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2024-11-05T22:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: Layout Refresh method for arcpy.mp</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/layout-refresh-method-for-arcpy-mp/idc-p/1557781#M32825</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1134"&gt;@JeffBarrette&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi, I would like to second this request. I am having trouble with my script that runs a series of geoprocessing tools on data to generate new buffer and line features from points in a feature class and then outputs a series of PDFs that are supposed to include the newly generated features in the maps. The script used to work fine in earlier versions of Pro, but for about four months the newly generated features are not visible in the exported PDFs. Once the script tool is completed, if I hit refresh in the layout window of the APRX, then the new features show up just fine. Sometimes (but not always) the features also show up just fine automatically in the layout once the script tool is finished, but by that point the PDF has been exported without the features showing up.&lt;/P&gt;&lt;P&gt;I've noticed that when the lock icon is on the layers in the table of contents during and after the geoprocessing tools that affect them are run, the features will not draw. As soon as that lock icon disappears (like if the script crashes for some other reason), usually (but not always) the newly generated features will immediately appear in the layout. I have not been able to figure out a way to get it to release the lock as a workaround either. I have also tried putting in arcpy.RefreshLayer and the CIM hack you mentioned above and having the script clearing out the workspace cache, but those haven't made a difference.&lt;/P&gt;&lt;P&gt;This is complicating my workflow because I am having to manually save out an APRX for each newly generated feature, open up that APRX, and then export the PDF from that as I cannot get Pro to output the PDFs properly with the script tool. A simple way in Arcpy to have Pro refresh the layout would be great.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2024 22:37:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/layout-refresh-method-for-arcpy-mp/idc-p/1557781#M32825</guid>
      <dc:creator>asmith_tssw</dc:creator>
      <dc:date>2024-11-12T22:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: Layout Refresh method for arcpy.mp</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/layout-refresh-method-for-arcpy-mp/idc-p/1558983#M32890</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/16421"&gt;@DougBrowning&lt;/a&gt;&amp;nbsp;are you working straight text? With straight text, regardless of alignment if you change the string to be something shorter, the text envelope that contains the text will be left aligned since that is the anchor point location.&amp;nbsp; If you change the anchor position to center and then modify the string, it should stay center aligned.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeff - arcpy.mp and Layout (SDK) teams.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 23:17:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/layout-refresh-method-for-arcpy-mp/idc-p/1558983#M32890</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2024-11-14T23:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: Layout Refresh method for arcpy.mp</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/layout-refresh-method-for-arcpy-mp/idc-p/1558985#M32891</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/466454"&gt;@asmith_tssw&lt;/a&gt;&amp;nbsp;could you share a small snippet of code that demonstrates what the script tool is doing?&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Jeff - arcpy.mp and Layout (SDK) teams&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 23:19:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/layout-refresh-method-for-arcpy-mp/idc-p/1558985#M32891</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2024-11-14T23:19:39Z</dc:date>
    </item>
    <item>
      <title>Re: Layout Refresh method for arcpy.mp</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/layout-refresh-method-for-arcpy-mp/idc-p/1559201#M32903</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1134"&gt;@JeffBarrette&lt;/a&gt;&amp;nbsp;Hi Jeff, thanks for responding. I'm not sure where to start to send a small snippet. My script tool is a 683 line long script that does a lot of geoprocessing operations before a loop runs to generate maps and PDF exports. How would you suggest I begin to show you the problem?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 15:39:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/layout-refresh-method-for-arcpy-mp/idc-p/1559201#M32903</guid>
      <dc:creator>asmith_tssw</dc:creator>
      <dc:date>2024-11-15T15:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: Layout Refresh method for arcpy.mp</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/layout-refresh-method-for-arcpy-mp/idc-p/1559376#M32908</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/466454"&gt;@asmith_tssw&lt;/a&gt;&amp;nbsp;- I need a reproducible case and it is so difficult to know what your script is doing and how it is interacting within the application.&amp;nbsp; For example, are you running script tool within the application or are you running a stand-alone script outside of the application?&amp;nbsp; Even if you could provide a bulleted list of the order of operations, that could be helpful.&lt;/P&gt;
&lt;P&gt;Jeff&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 21:45:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/layout-refresh-method-for-arcpy-mp/idc-p/1559376#M32908</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2024-11-15T21:45:32Z</dc:date>
    </item>
    <item>
      <title>Re: Layout Refresh method for arcpy.mp</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/layout-refresh-method-for-arcpy-mp/idc-p/1559798#M32912</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1134"&gt;@JeffBarrette&lt;/a&gt;,&amp;nbsp;thanks for your response. I will try to outline what the script does. It is a script tool being run within Pro. The important input to the tool is a point feature class that we update every day with points for residence addresses. We get daily map requests from our client to do a buffer analysis on residence points and see if there are businesses within a 25-mile radius to the residence points or if the point falls outside of that distance. I won't go over all of it but I will lay out the important parts.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Input the residence address points as a feature class.&lt;/LI&gt;&lt;LI&gt;Select out the points that are new using a table that we also input into the script tool for each batch of map requests.&lt;/LI&gt;&lt;LI&gt;Create 25-mile buffers around those points and append the newly created buffers to an existing buffer polygon feature class that is in the layout.&lt;/LI&gt;&lt;LI&gt;Find the nearest business point for each residence.&lt;/LI&gt;&lt;LI&gt;Create a line feature connecting the residence to the nearest business point and append those features to an existing line feature class that is in the layout.&lt;/LI&gt;&lt;LI&gt;Create a line feature class that dissolves the buffer and the line made above so that we can have an extent for the output PDF map in situations when the business is farther away from the residence than 25 miles. Append that dissolved line to a line feature class that is in the layout.&lt;/LI&gt;&lt;LI&gt;Then for each new residence point, create a PDF map that has three map panes. One pane shows the residence, the nearest business point, the 25-mile buffer around the residence, and the line connecting the residence to the nearest business. The second and third panes are zoomed in to show the residence and the nearest business in detail.&lt;/LI&gt;&lt;LI&gt;The loop that creates each PDF uses definition queries for the feature classes in the map layout to show only the features relevant for each residence. The loop also saves out an APRX for each map request so that we can fix the PDFs if there are issues.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;The problem here is that the feature classes in the map layout that are being appended to (the buffer, the distance line, and the dissolved combination of the two) are not showing up in the PDF export after the new features for the current batch of new residence points have been generated and appended to them. As soon as the script is done running, then they will show up in the map if you refresh the layout, but by that point the PDFs have already been exported and the newly created features are not showing up in those exported PDFs.&lt;/P&gt;&lt;P&gt;Until a few months ago, this process ran smoothly and did not need workarounds for the PDFs to be generated correctly. Now I have to open up each APRX that the mapping loop saves for each map request and export the PDF from those one-by-one.&lt;/P&gt;&lt;P&gt;I hope this is helpful. If not maybe I can set up a call with tech support to show the process in action.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2024 18:17:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/layout-refresh-method-for-arcpy-mp/idc-p/1559798#M32912</guid>
      <dc:creator>asmith_tssw</dc:creator>
      <dc:date>2024-11-18T18:17:06Z</dc:date>
    </item>
  </channel>
</rss>

