Save view-port in local path in grasshopper using a different display mode

Dear Rhino Community,

I am trying to assist a friend with this request, their goal is to save their view-port in their local path in grasshopper, using a different display mode. For example, when they are working on ‘perspective’ mode with ‘Rendered’ display mode, they want to save current ‘perspective’ with ‘my_personal_display’ display mode. Main point is to maintain ‘Rendered’ display mode in current rhino perspective but to save current ‘perspective’ view with ‘my_personal_display’ display mode.

They looked over rhinocommon api but couldn’t find a helpful method. It only allows them to change current active viewport. For example, when they run rs.ViewDisplayMode(‘Perspective’, ‘my_personal_display’), it automatically changes their current viewport.

I hope that I can assist them from the advice I receive on this website. They are not on the Rhino forum so I am doing this a a favor for them, and myself for that matter.

Best Regards,
Michael Wickerson

Is this not the same as Question regarding rs.ViewDisplayMode and Is it possible to save rendered viewport image when current viewport is shaded? ?

Anyway, the way to go about this is to change the active viewport mode to what they want, capture it, then change back to whatever the display mode was.

Here a Python example to capture the active view

And to get a specific DisplayMode you can use

display_mode = Rhino.Display.DisplayModeDescription.FindByName("Wireframe")

and then set the view to use that with something along the lines of:

view = sc.doc.Views.ActiveView
view.ActiveViewport.DisplayMode = display_mode

Thank you very much, I will pass on this wonderful and clear information. Mike