2

Using ArcMap 10.1, since there is not a way to control portrait or landscape of the layout view through python, is there a way to switch layout templates without opening a new mxd through python?

Since there is a change layout template button it would be nice to have a python function to do the same.

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Apr 4, 2013 at 23:02
0

1 Answer 1

1

You could request this as an ArcGIS Idea but so far, at least for me, requirements like this have been easy to meet by just opening a new MapDocument object so I suspect it would not attract a lot of votes.

For example, when Selecting predefined ArcMap template using ArcPy? means a "predefined template" to be an MXD located in a Map template folder inside an ArcGIS installation directory, it should just need:

mxd = arcpy.mapping.MapDocument(r"Current")

(although there is no need for the r before "Current" above)

to be replaced with:

mxd = arcpy.mapping.MapDocument(r"<path>\<template>.mxd")
answered Jan 24, 2016 at 22:30
4
  • I took "predefined template" to mean a layout template you'd typically use the "Change Layout" button on that Layout toolbar in ArcMap. Changing the MapDocument here wouldn't give the same result. Commented Jan 24, 2016 at 22:34
  • @Midavalo I've not tested recently but I think it would at any version from 10.0 onwards i.e. since *.mxt files ceased to be used to define map templates. Commented Jan 24, 2016 at 22:37
  • Predefined templates now use MXD instead of MXT, however the button still exists and functions the same way "Change Layout - Change the Layout by selecting a predefined template" is the tooltip text. Using arcpy.mapping.MapDocument would just make arcpy run on a completely different MXD rather than use one MXD as a template for the CURRENT. Commented Jan 24, 2016 at 22:41
  • @Midavalo There's no ArcPy method to do precisely that, and ArcPy is primarily designed for map automation with less emphasis on using it interactively within ArcMap. I think that is a pity sometimes, but I think it also means that the way I have suggested may be the asker's best option. Commented Jan 24, 2016 at 22:48

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.