Is it possible to animate the Rhino viewport with Python in order to run, for example a simulation that you can follow in real time, instead of seeing just the outcome. I’m currently looking for a Rhino Python solution without grasshopper!
A simple example would be a moving point that is - each frame or iteration - randomly displaced, and its movement can be seen live in the Rhino viewport.
I tried this, but it didn’t really work:
import Rhino.Geometry as rg import rhinoscriptsyntax as rs import random import time run_time = 10 pt = rg.Point3d(0.0, 0.0, 0.0) for t in range(run_time): vec = rg.Vector3d(random.random(), random.random(), 0.0) pt += vec pt_id = rs.AddPoint(pt) time.sleep(.25) if t < run_time - 1: rs.DeleteObject(pt_id)
Getting the timing right is nearly impossible and creating, then deleting objects each frame is probably not very clever either!
Update (March 25th, 2019):
Forced viewport animations are currently not possible in Rhino for Mac v5 (5.5.3 or lower). They seems to be working in the current v6 (WIP), though.