Set CPlane with Script, and back to World again?

Q: Is it possible to set, with a Python/VB script a Construction Plane to be used by Grasshopper (and by custom made Script components in GH), and restore back to Word again?

I will need to manually (push button) set the CPlane to different reference objects already in place in a CAD template. I know how to set a CPlane in GH, for example based on an existing Surface, and GH components can use that CPlane.

Q: But, can I also set that very CPlane in a Rhino Viewport so that it can be used in manual user interaction (after the user selects a reference surface and pressing a button to create a CPlane from that ref. surface).

Related post in which I will make use if this:

Now, in the linked example GH already uses CPlanes created from ref.surfaces, when creating the “rays” pictured in the previous link, but those CPlanes were not assigned with Scripts, they were assigned manually to GH components, like so :

// Rolf

Anyone?

Hi Rolf,

each RhinoViewport has a construction plane which you can get or set.

in rhinoscript syntax for python you can use rs.ViewCPlane(). Does that help ?

c.

Thanks, looks promising! How could I miss that? I didn’t think in terms of Viewport when searching, I was totally unto CPlane.

Anyway, hopefully I can get hold of the current Viewport as well,
http://developer.rhino3d.com/api/RhinoCommonWin/html/P_Rhino_Display_RhinoPageView_ActiveViewport.htm

// Rolf