List layout page names?

Hi folks,
do you think there is any chance to fish out the layout names and list it / export it? I need to create a drawing list and looking for a more convenient way :slight_smile:

Hi @petumatr,

import Rhino
import csv

_exportFilepath = "C:/layoutNames.csv"
_delimiter = ";"  # your local Excel columns delimiter


pageView_L = Rhino.RhinoDoc.ActiveDoc.Views.GetPageViews()
layoutName_L = [pageView.PageName   for pageView in pageView_L]

with open(_exportFilepath, mode='wb') as file:
    csvWriter = csv.writer(file, delimiter=_delimiter, quotechar='"', quoting=csv.QUOTE_MINIMAL)
    
    csvWriter.writerow(['Index', 'Layout Name'])  # header

    for i in xrange(layoutName_L.Count):
        csvWriter.writerow([str(i+1), layoutName_L[i]])
1 Like

wow, thank you @djordje!!!

1 Like

Let’s say I was trying to do this, but instead of exporting as a .csv, I wanted to drop this list into a text holder on a layout.

Any scripting wizards available to point me in the right direction?

This is what I use, py which prints any layout names in file which then can be copied into text

import Rhino

# Get the current document
doc = Rhino.RhinoDoc.ActiveDoc

# Get the page views in the document
page_views = doc.Views.GetPageViews()

# Loop through each page view and print the page name
for view in page_views:
    page_name = view.PageName
    print(page_name)

Hi @o-lit, thanks for the script. @djordje’s technique seems to yield similar results. The workflow solution I’m looking for is ideally a little more automated and would avoid an export and copy/paste. In other words, we don’t have that many sheets, it’s more about not having to type the name into the layout page name and then copy the same information into a separate data field.

They way I’ve got it running now is by using enhanced text fields and targeting each sheet individually to display it’s name and naming each layout by it’s sheet name, for example: A1.0 - Site Plan. This seems to have the fewest moving parts for now and keeps us from having to spell check the same object twice.

That looks like a long list of this:

%<PageName(“layout ID”)>%
%<PageName(“0eff519a-782e-4991-8819-f361c923fca4”)>%

The object IDs are a little obtuse. If there was a way of targeting each layout by its order/index and not its distinct ID, it would keep us from having to double handle the sheet index, but considering we also use it to track revisions and when sheets get added, having a manual step of reviewing the sheet list isn’t the worst thing in the world.