Is there a way in Python 3.x to programmatically select a layout element, such as a scale bar? Thanks much, cob
they give an example of moving a scalebar in this tutorial
Create a map book with Python—ArcGIS Pro | ArcGIS Desktop
Thanks Dan, but it is actually never selected in that example, just repositioned. I can set the map frame as well, but there must be a programmatic way to select the element, so that when I open the properties page with a task step it pertains to the selected element?
Charles, you will need to sniff around in the arcpy section for other examples of **element things.
MapsurroundElement—ArcPy | ArcGIS Desktop
but it requires you know the element name
Yes I know the name - I can set the map frame and do all sorts of things to the elements, but can't figure out how to select one. I also don't see how to add items to the Legend_Element but I think this is another bug issue. Thanks, cob
My read is that when 'select' an element of any kind by name or index number... it is selected/active/??? and you should be able to work with it. It may be that the mp module expects to be used to modify existing things, and your case of adding to the legend element would probably necessitate going back to the beginning with adding a layer and symbolizing it from scratch... I don't use it enough.. most of my mapping uses a template structure
If it is ever selected, it doesn't stay in the selected state once the script completes. I was looking for a way to set this state in the code - I would think 'select' would be something that would apply to existing objects(?) As far as the Legend goes, it's pretty flaky. If you programmatically set the map frame, it works in the properties but does not add any layers from the frame to the existing legend. But if you add just one layer to the legend manually (drag it in the TOC) when the frame is set to None, then when you set the map frame all of the layers in the frame are added. I'm just trying to persist the settings of these elements with the user's content. There may be a better way but I haven't found it (?) Thanks Dan - cob
Retrieving data ...