Rotate View Instantly

Hi, I am trying to make cameraview rotate around a target instantly,
but i dont know where i went wrongly,

import rhinoscriptsyntax as rs 

for i in range(360):

    viewPort = rs.CurrentView()
    tar = rs.ViewTarget(viewPort)
    cameraPlane = rs.ViewCameraPlane(viewPort)
    rotated = rs.RotatePlane(cameraPlane, 1 * i, [0,0,1])
    newView = rs.ViewCPlane(viewPort, cameraPlane)

I think you want a script that works something like the following

import rhinoscriptsyntax as rs
import Rhino

for i in range(360):
    viewPort = rs.CurrentView()
    rs.RotateView(viewPort, 0, 1)
1 Like

perfect, thank you Steve

there are two things i would know about,

first, what is that things let me control (wait) the timing or redraw and set it according to seconds milliseconds like how it works in grasshopper timer, or in processing frameRate command


how can i make the rotation function work instantly, without affecting/be affected by the running/stop of the scripts, and make the view turn around INSTANTLY, until i ask it to stop rotating or i end the script

This is a bit off topic, but you might find what you need in the “turntable” command.

And I am not sure what you mean with INSTANTLY, do you mean CONTINUOUSLY?

Do you want the viewport to spin all the time, even when you are working on the Rhino file?

If you just want it to spin until you hit [escape] then you have to add

import scriptcontext

to the start, and then:

#check for esc press
if scriptcontext.escape_test(False):
    break      #get out of the loop

into the script, and put the script in a “Wile true”: loop.

The script will then look like this:

import scriptcontext
import rhinoscriptsyntax as rs
import Rhino

viewPort = rs.CurrentView()

while True:
    rs.RotateView(viewPort, 0, 3.6)
    if scriptcontext.escape_test(False):
1 Like


I think there is something goes wrong when i applied the script,
the script is running, and still running, until now
i even opened new file, i deleted the script from grasshopper and python,
but the view port still rotating

and the escape test never work

Hm… That’s strange. I don’t use Grasshopper now, so the script was intended for “pure” Python script use.
(To be used in the Python script editor)

Maybe @stevebaer can help you out.

Could you quit Rhino to stop the script?

mmmm, yes, that is the only thing you can do, because it take all the processing
even when you delete the python script, and close the grasshopper file, and even start a new file, the Rhino file keep spinning, and even when i open a new rhino file, without closing, its still rotating

i need the rotation to work without interrupting the process of running the script

I am working on Jake Hebbert Scripts

If you are in Grasshopper, just use a Grasshopper timer to control the interval. That would force your script to be executed on an interval


and what about the module called Time in python ( import Time)
how does it work

I tried this

Here’s a grasshopper definition that hopefully displays how to do this (2.3 KB)

1 Like

Thank you Steve
i think i am using the old version

can you write the code
or share it with the older version

Just curious; is there a reason you can’t update?

1 Like

Also, the code inside the component is simply

import rhinoscriptsyntax as rs

viewPort = rs.CurrentView()
rs.RotateView(viewPort, 0, 3.6)

The grasshopper timer is wired up to this component and causes it to execute at every interval.

I Think it is a student version,

But how do i apply a time interval ( by seconds or milliseconds) inside the a scripting in python

Hmm, you don’t know for sure? It should say in the title bar “Educational”. If you have a real student version, you should be able to update it to the latest service release.


1 Like

i think its not real student version :frowning:
so this why it seem not updating