Created
November 13, 2014 19:46
-
-
Save amarinelli/d882056d04f98cf892ba to your computer and use it in GitHub Desktop.
Set style of legend items to user style and tests 'Override default patch' property. Mxd.save() seems like the key here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import arcpy | |
| mxd = arcpy.mapping.MapDocument("./Legend.mxd") | |
| df = arcpy.mapping.ListDataFrames(mxd)[0] | |
| #Setup Legend | |
| legend = arcpy.mapping.ListLayoutElements(mxd, "LEGEND_ELEMENT")[0] | |
| styleItems = arcpy.mapping.ListStyleItems("USER_STYLE", "Legend Items") | |
| for styleItem in styleItems: | |
| if styleItem.itemName == "PATCH_Single": | |
| legendStyle = styleItem | |
| for lyr in legend.listLegendItemLayers(): | |
| legend.updateItem(lyr, legendStyle) | |
| mxd.save() | |
| print "done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment