Deleting Page Layouts

I can’t figure out how to delete Page Layouts.
I’ve tried this:


but that doesn’t work.
I’ve looked in the RhinoCommon docs, but even there I can’t find any other way of doing it. The ViewTable class doesn’t have a remove counterpart to it’s AddPage method.

Any tips?

Hmm, just looking at the api doc, the Rhino.PageView class has a “Close” method…
(inherited from RhinoView)

Don’t know if that will do it…

Isn’t that the same method I attempted to call (and linked to?) Or am I missing something?

Yeah, sorry, too late last night…

The following seems to work for me to close all layouts - which I think is the same as deleting them:

import scriptcontext as sc
import Rhino

for p_view in p_views:

You would of course need to refine that to close only the layouts you want…

Is this more or less what you’re looking for?


My bad. It works’ish, but the Layout UI doesn’t update on Mac WIP: the pages are still visible. Only after closing the Layout window, and reopening it, is it updated. Further the “Closed” pages, keep hangin around in the view table:

import scriptcontext as sc

p_views0 = sc.doc.Views.GetPageViews()
num_pviews_before = len(p_views0)
for p_view in p_views0:

p_views1 = sc.doc.Views.GetPageViews()
if (len(p_views1) == num_pviews_before):
    raise Exception("zombie pages detected. Run!")

Results in the Exception being raised.

I suppose I’m missing calling one of the commit/redraw methods, but I can’t figure out which one?

OK, I didn’t check on Mac… The views are not left hanging around in the view table in V6 for Windows after closing.



Probably a bug on the Mac side… maybe nothing you can do until it’s fixed.

Does calling a redraw help in any way?


I attempted the sc.doc.Views.Redraw() in between, but it doesn’t work.

Thanks a lot for your taking a look @Helvetosaur!

If anyone from McNeel is listening in on this, you can use the minimal test case above to reproduce the buggy behavior. You just need to have some existing layouts before running it.

@Alain - do you have any idea what might be happening here?

1 Like

Hi Mitch, No but I logged the issue.
Thanks for looking into it.

1 Like

This bug should be fixed in the latest RhinoBETA.

1 Like

Is there a reason why the page layout closing isn’t undoable? That’s what I see anyway. (after runpythonscript)


Some events in Rhino are not added to the internal undo list, so do not get undone… I don’t know if this applies in this particular case but you can add them manually like this: