Return the Number of Layout Views in Rhino File

Is there a way to determine how many layout views exist in an open Rhino File? I want to auto assign a name and give it an increment number += 1 greater than the number of layouts that exist in the file.

Eric

Hi Eric,

you could loop through the rhino views and filter the RhinoPageView type.

import Rhino as rh
import scriptcontext as sc

L = []
for i in sc.doc.Views:
    if type(i) == rh.Display.RhinoPageView:
        L.append(i)
print len(L)

1 Like

This will work for me!!! Thank you very much.

Eric

This works too:

import scriptcontext as sc
print sc.doc.Views.GetPageViews().Length

1 Like

Ah didnt know there is already a lenght property
thanks

Thank you all. It’s nice to know one can access all these properties.