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.
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)
print(num_pviews_before)
for p_view in p_views0:
p_view.Close()
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?
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.
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: