Select to view content in your preferred language

printed layouts list to screen different than their DB order

275
1
Jump to solution
01-07-2023 10:01 AM
BarakGarty
New Contributor II

I am running the following script, just printing each layout in the project and its elements (total of 3 layouts). The printout (code below) order is Layout 2, then 3 then 1. In the DB the Layouts listed 1>2>3 like I'll except it to be.

Why is it printing not in the order it is listed? How can I set it to print like these objects are maintained in the DB? the printout this code currently issues is listed below:

Project layouts and their elements list:
Layout2
Legend
North Arrow
Scale Bar
Map Frame
Layout3
Map Frame 2
Map Frame 1
Map Frame
Layout1
Map Frame
Finished printing all project layouts and their elements

 

 

    print("Project layouts and their elements list:")
    for l in aprx.listLayouts():
        print (l.name)
        for el in l.listElements():
            print ("    " + el.name)
    print("Finished printing all project layouts and their elements\n")

 

 

  Thanks in advance.

0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

I could be wrong, but I think the 'display' order can be different than the created order and I suspect that these were created in the order that it is printing in. The TOC's/ panes are basically JSON files containing the object info and listLayouts is probably ordering the items by created order.  You could do a sort in the code to force them to be sequential.

View solution in original post

0 Kudos
1 Reply
by Anonymous User
Not applicable

I could be wrong, but I think the 'display' order can be different than the created order and I suspect that these were created in the order that it is printing in. The TOC's/ panes are basically JSON files containing the object info and listLayouts is probably ordering the items by created order.  You could do a sort in the code to force them to be sequential.

0 Kudos