Rhino Python Display


#1

Dear all,

I got a query about running python script in rhino – How can I let rhino redraw every step when the script running? Be default, in order to speed up the script, rhino will skip displaying some steps before the final outcome. Say, if I let python add 1000 points in rhino, it will just display the first few points and then it stop showing anything until it finish adding 1000 points. How can I let it show the process adding every single point?

Thanks for any suggestion,


(Pascal Golay) #2

Hi Jack - you can add

import scriptcontext as sc

to the top of your script if it is not there, then add

sc.doc.Views.Redraw()

inside your loop where you want to see the action.

Does that do it?

-Pascal


(Willem Derks) #3

Hi,

I’d say rhinoscriptsyntax.Redraw() is more robust.
or rs.Redraw() depending on your module import

It adds a Rhino.RhinoApp.Wait() to make sure the redraw is finished.

-Willem


#4

Thanks Pascal and Willem, I wonder what is the difference for these 3 ways of doing? Why rhinoscriptsyntax.Redraw() is more robust?
Thanks


(Steve Baer) #5

Robust may not be the exactly correct term, but Willem’s suggestion is the one you should use. The Redraw function that Pascal mentions tells the operating system that a viewport needs to be redrawn but doesn’t immediately force the redraw to occur. The function that Willem mentions does the same thing, but additionally calls Wait which allows Rhino to process the redraw request.