I am trying to write a python script that will allow me to create multiple templates based on page size/ setup. I am trying to figure out how to insert a new blank layout tab using python script. Does anyone know the syntax for this?
Any other help with python scripts for layout formatting would also be greatly appreciated.
Thanks!
HI Hailey,
Here are some links to help you get started.
Help topics:
https://pro.arcgis.com/en/pro-app/arcpy/mapping/introduction-to-arcpy-mp.htm
https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/mapseries-class.htm
https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/layout-class.htm
List of ArcPy.mp samples - https://esriurl.com/8899
Hope this helps,
Tom
Thank you!
Hi there!
Did you figure out how to create a new layout? All the scripts I read just open an existing one.
No I was never able to figure it out. I ended up creating a master aptx, without a script, with all of the layouts I would need. Then when I open it, I choose the layouts I want and delete the others.
Hi HaileyG,
I hope that will help you
#Create the new layout
layout_name = 'layout_test'
layout = project.listLayouts()
print (layout)
#Check if the layout exits already, if not, create it
if not layout:
print ('No Layout')
layout = project.createLayout(210,297, 'MILLIMETER', layout_name)
else:
print ('we have one layout')
layout = layout[0]
print (layout.name)
How to create new Layout using arcpy was list under is acpy.mp class and also mentioned in Layout class. as TomBole mentioned.
project = arcpy.mp.ArcGISProject(project_path)
if you wonder what is the project