Disabling Redraw on the Rhino Viewtable will allow you to make bulk geometry and layer panel changes before showing them in the viewport. If the intermediate steps are slowing your script down, then you should try turning it off.
Take the purge layer method for example:
rs.PurgeLayer("Layer::Sublayer")
This script tends to take Rhino some time to execute with deep nested layer structures. That’s because it provides visual feedback for each layer that it deletes. To speed it up, let’s wrap it with some Redraw property changes.
rc.RhinoDoc.ActiveDoc.Views.RedrawEnabled = False
rs.PurgeLayer("Layer::Sublayer")
rc.RhinoDoc.ActiveDoc.Views.RedrawEnabled = True
This will cut out the visual feedback and only show the user the layer table when the operation is done.
The same principle can be applied where complex geometry changes may slow down your script, due to render meshes being re-calculated and shown to the user.
Do you want to get in touch about a specific design or scripting challenge you’re facing? Contact me through the tab above.
Do you have thoughts, questions, or feedback? Let me know on LinkedIn: