Hi All,
Looking for recommended approaches to reorder layout elements in the Contents sidebar using ArcPy CIM. I'm assuming that I can just move elements around by their list index in the Layout definition?
Yes.
This script reverses the order of layout elements in the content pane and in the layout itself:
layout = arcpy.mp.ArcGISProject("current").listLayouts()[0] cim = layout.getDefinition('V2') print([e.name for e in cim.elements]) # layout elements from bottom to top #['Map Frame', 'Scale Bar', 'North Arrow', 'Map Frame 1', 'Table Frame'] cim.elements.reverse() print([e.name for e in cim.elements]) #['Table Frame', 'Map Frame 1', 'North Arrow', 'Scale Bar', 'Map Frame'] layout.setDefinition(cim)
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.