3

Is it possible to create some MXD from a list using Arcpy stand alone snippet? For example if I have a list like

counties = ['Benton', 'Caroll','Polk','Scot']

can I run a code like

import arcpy

for mxd in counties 
    MXD = arcpy.mapping.MapDocument(r"C:\\"+ mxd+ '.mxd')
    MXD.save()
PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Mona Coder
  • 416
  • 1
  • 5
  • 16
  • 4
    No, arcpy cannot create a new MXD. I create an empty doc with ArcMap, mark the file read-only, drop it in a temp folder within the app, then use SaveAs to write the new doc.. – Vince Oct 19 '18 at 00:16
  • Wow! I like this naughty idea! ;-) – Mona Coder Oct 19 '18 at 00:25
  • Supported by https://community.esri.com/ideas/7073 I use a similar procedure for other template objects; For your information see https://stackoverflow.com/questions/50499/how-do-i-get-the-path-and-name-of-the-file-that-is-currently-executing about getting the path of the script that is executing, keep your blank MXD with the script, that way your script will be more robust about being moved. – Michael Stimson Oct 19 '18 at 00:45
  • Use the same trick with Group Layers, but be careful that the folder is empty when you save it (lest the contents be included). – Vince Oct 19 '18 at 02:09

0 Answers0