Renumber Layouts

Hi everyone, I’ve been diving deeply into using layouts in Rhino 7. They are rather efficient for my workflow; however, some things could be improved. I am looking for an easier way to renumber layouts. Currently, I am doing this per the layout menu one by one. Is there a way to import a .csv list through a rhino script or python script that would modify my current layout numbers? This would be a great feature! I am in the beginning stages of trying to learn Python with the hopes that I can bring tools like this to those who may benefit.
Any assistance is greatly appreciated!!


1 Like

Hi @Chris_Conti,

Maybe something like this?

import Rhino
import scriptcontext as sc

def test_sort_pageviews():
    # get the page views as an array
    page_array = sc.doc.Views.GetPageViews()
    if not page_array or len(page_array) < 2:
    # convert array to list
    page_list = [pv for pv in page_array]
    # sort the list by page name
    sorted_list = sorted(page_list, key=lambda pv: pv.PageName)
    # reorder page views
    page_number = 0
    for pv in sorted_list:
        pv.PageNumber = page_number
        page_number = page_number + 1

if __name__ == "__main__":

– Dale