Using Python to Change Layout Templates

1738
6
02-12-2013 03:04 PM
Status: In Product Plan
Labels (1)
KacieVanasse
New Contributor II
It would be beneficial to be able to use the arcpy.mapping module to change the layout template in the layout view by pointing to the path of the template.

For example, currently on the layout toolbar there is a button called Change Layout. When you click it a window will pop up allowing you to change your layout template to something else (ex. Architectural Page Sizes > ARCH A Portrait.mxd).

It would be nice if users were able to incorporate the selection of this template in python scripting for map making purposes.
6 Comments
BertHavekes
I agree with kvanasse. Changing the layout (while using "CURRENT" as mapdocument) is an important improvement!
CraigAnderson

Have there been any thoughts from ESRI on this?

This would be a valuable addition to arcpy, as I could create some great automation scripts for my users who must often replicate the same map in multiple sizes.

JeffBarrette
Status changed to: Under Consideration

Thank you for your feedback.  There is a long answer to this. 

First, the Layout team is developing commands for 3.1 that allow you to resize a layout AND have an option to scale layout elements proportionally.  The same resize boolean is available to copying a layout. 

Second, arcpy.mp (NOT arcpy.mapping in ArcMap) is also being expanded.  At 3.1 we are adding content management functions to copy project items like maps, layouts, and reports.  This allows you to make a copy and then automate changes to the copy.  arcpy.mp already allow you to change the page size - the problem is that is does NOT automatically resize elements.  That option can't come until after the Layout commands are completed.  At 3.1 arcpy.mp is also adding the ability to CREATE new maps but NOT layouts (yet).  That is because arcpy.mp traditionally doesn't allow you to create new objects so why create a layout when you can't create things like map frames, scalebars, etc.  This is definitely something we want to get to longer term. 

Jeff - Layout and arcpy.mp teams

saraswathiemani2

With reference to layouts (" but NOT layouts (yet)"), do we have in arcpy now to create a new layout? 

Thank you in advance.

JeffBarrette

@saraswathiemani2 we are introducing the following at 3.2.  ArcGISProject functions can create elements on a layout OR a graphics layer in a map.

ArcGISProject.createLayout()

Layout.createMapFrame()

Layout.createMapSurroundElement()

ArcGISProject.createGraphicElement()

ArcGISProject.createGroupElement()

ArcGISProject.createPictureElement()

ArcGISProject.createPreDefinedGraphicElement()

ArcGISProject.createTextElement()

JeffBarrette
Status changed to: In Product Plan

This should be available with Pro 3.3.

Layout.changePageSize(page_width, page_height, {resize_elements=True})

 

Jeff - Layout and arcpy.mp teams