0

I`m trying to create a bunch of .mxds from a custom template, that get named and populated with data differently according to their location.

I need the exact positioning and look of my customized ArcMap toolbars and menus that are saved within the template to be applied to the created .mxds. In addition I need to save the Mapdocuments for older ArcGIS Versions (from 10.5 -> 10.1/10.2)

The Code works as expected except for the arcpy saveACopy (file_name, {version}) method. When no Version number is specified, the method keeps the customizations saved in the .mxds as required.

However when a Versionnumber like '10.1' is given, the method strips all customizations from the .mxds and the 'Save all customizations to the document' option in the "Customize' menu > Options tab" is unchecked, thus the .mxd uses whatever normal.mxt was specified by the users.

The strange thing is, when I use the manual 'Save a Copy' Option in ArcMap for the same .mxds it works just fine and keeps the customizations. That said, saving by hand is no option with the high number of created files.

Is there a knowen difference in the arcpy.saveACopy method and the manual 'save a copy' or is this a bug?

If so can anyone offer a Workaround with ArcPy for saving .mxds for prior ArcGIS versions without losing the specified toolbar and menu customizations?

# iterate over all templates, create .mxds for every location and fill with corresponding data
for mxd_name in mxds:
    for location in locations_d:
        # open the mxd
        mxd = arcpy.mapping.MapDocument(mxd_name)
        # correcting the dataframe-name
        df = arcpy.mapping.ListDataFrames(mxd)[0]
        df.name = location
        # replacing all datasources and queries
        for layer in arcpy.mapping.ListLayers(mxd):
            # manipulate the mxd
            # [...]
        # save the mxd
        mxd_path = os.path.join(output_path, os.path.basename(mxd_name).replace(template_mxd_suffix, ''))
        mxd.saveACopy(mxd_path, '10.1')
        del mxd
  • Maybe some of the customizations aren't supported at the ancient releases. 10.1 is long retired, and 10.2 imminently so. I'd trust ArcGIS to know what features were added at 10.3, for example, and therefore weren't available at 10.2. – Vince May 7 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.