Redraw and Layers panel

This seems to work:

import Rhino
import scriptcontext as sc

sc.doc.Views.RedrawEnabled = False

plane = Rhino.Geometry.Plane.WorldXY
circle = Rhino.Geometry.Circle(plane, 5.0)
sc.doc.Objects.AddCircle(circle)

sc.doc.Layers.Add()

sc.doc.Views.RedrawEnabled = True

Setting RedrawEnabled = True will redraw the document and refresh the layer panel (if it is open).

– Dale

@dale
My use of False refers back to the Rhinoscript usage further up in this post:

Call Rhino.Redraw(False)

For Python use what I am getting is the following:

To turn redraw back on and do a redraw of all views with panels included I use:

from scriptcontext import doc
doc.Views.RedrawEnabled = True

while to redraw all views without panels I use:

doc.Views.Redraw()

and to redraw a single view without panels I use:

doc.Views.ActiveView.Redraw()

Please let me know if this is not right or if there are simpler or additional ways that would be interesting to consider.

Thanks,
Terry.

hi @Dale,

Following up about the Redraw update to RhinoScript - the modification you made to enable redrawing of only viewport and not UI was a game changer for the interactive scripts that rely on constant viewport updates. In allows now to do really cool things with that, with no slowdown.

One thing I have been running into, and potentially a wish-pile item for V7 if possible, is the ability to run Rhino.EnableRedraw without actually redrawing the views/UI, or with just redrawing views but not UI. Most of the tools that take advantage for the fast redraw still work like:

Rhino.EnableRedraw False
Start Loop
   Do Something
   Redraw False (fast redraw)
End Loop
Rhino.EnableRedraw True

So the last line always results in the full redraw, and very noticeably a blink in the Layers panel if any layers are highlighted.
The wish would be to be able to re-enable redraw with either no instant redraw or just “views only” redraw. Maybe an additional argument in the EnableRedraw method?

thanks again

–jarek

@Jarek - I added your wish to the pile.

https://mcneel.myjetbrains.com/youtrack/issue/RH-53089

– Dale

Thanks!