Well, I'm using ArcGIS Pro 2.7 and I want to turn off the 'Headings' from Legend Item. I know how to do it manually, but I need to make a script. Thanks by attention!
Hello Wesley,
This can be accomplished using Python CIM Access:
https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/python-cim-access.htm
Here is a snippet of code that does what you need.
p = arcpy.mp.ArcGISProject('current') lyt = p.listLayouts()[0] #Get the layout's CIM definition lyt_cim = lyt.getDefinition('V2') #Iterate though all layout elements to find the Legend element for elm in lyt_cim.elements: if elm.name == "Legend": #Legend item changes for itm in elm.items: if itm.name == "GreatLakes": #Update visibility itm.showLayerName = True itm.showHeading = False #Set the CIM changes back to the layout lyt.setDefinition(lyt_cim)
There are many Python CIM Access samples located here (including legenditem changes):
https://www.arcgis.com/home/item.html?id=8772f61319584882bb697ba003030636
Jeff - arcpy.mp and Layout teams
Thanks a lot, Jeff!
If it isn't on the CIM stuff, it may not be available yet.
I've ever seen the Documentation above.
Did you look at the CIM class? For example
LegendElement—ArcGIS Pro | Documentation
LegendItem—ArcGIS Pro | Documentation
plus others.
You didn't indicate what you had looked at.
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.