How to switch back to model space from paper space?

To draw in MyCustomLayout Layout Paper space I do:

import scriptcontext as sc
sc.doc.Views.ActiveView = sc.doc.Views.Find("MyCustomLayout", False)

To go back and draw in model space I do:

sc.doc.Views.ActiveView = sc.doc.Views.Find("Top", False)

However this sometimes fails when Top does not exist. (or Rhino is set to another language).

Is there another save way to ensure geometry objects get added to Worlds XY Layout space?

Hi @Goswin, maybe using the object attributes when adding the objects eg:

attr = Rhino.DocObjects.ObjectAttributes()
attr.Space = Rhino.DocObjects.ActiveSpace.ModelSpace

I had a similar problem and used DefinedViewportProjection, but this was for setting the view projection of details i added in the layout…