import arcpy, os mxd = arcpy.mapping.MapDocument(r"C:\Temp\Test.mxd") df = arcpy.mapping.ListDataFrames(mxd)[0] for lyr in arcpy.mapping.ListLayers(mxd): lyrFile = arcpy.mapping.Layer(r"C:\Temp\Test.lyr") layerName = lyr.name arcpy.mapping.UpdateLayer(df, lyr, lyrFile, False) lyr.name = layerName del lyrFile mxd.saveACopy(r"C:\Temp\Test2.mxd") del mxd os.startfile(r"C:\Temp\Test2.mxd")
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.