Setting the active view with Python

Hi all,

I apologize in advance if this is a newbie question. I was trying (without much success) to set the active view automatically with python, so that when I use python to render it will always get the specific view I would like to render first, and only then run the render command.

I have found this:

But this only lets the user set the active view by CLICKING on it in the command line, while i would like to SPECIFY the view name IN THE CODE, so that when I run the code it will automatically change to that view. In pseudo code:

good_view=some_saved_view
Set_Active_View(good_view)
Render_Active_View

Does anybody have any useful insight regarding this?

Thanks in advance,

Yuval.

Hi Yuval,

No need to apologize; this community is for answering questions no matter what level.

does this help:

import rhinoscriptsyntax as rs

#if the view is already setup correct:
rs.CurrentView('Top')

#if you need to restore a named view first:
rs.RestoreNamedView('named1')

-Willem

1 Like

Hi Willem,

Thank you, it works perfectly!
I really appreciate the quick (and helpful) advice - I spent two hours of my life trying to get this done.

I hope to get my skills up so i can also help others here:)

Cheers,

Yuval.

1 Like