Hi, I have a script that disables redraw for speed while it creates geometry, then enables it again afterwards:
import rhinoscriptsyntax as rs
rs.EnableRedraw(False)
…do stuff…
rs.EnableRedraw(True)
In rhino 5 it works as expected.
However when I run the same script in rhino 6 I can see the geometry being created in front of me on screen (and it takes minutes to complete, as opposed to seconds in rhino 5) - redraw is not disabled.
Is there something I’m not aware of here? Does redraw() behave differently in rhino 6 than it does in rhino 5?
In case it’s relevant, here is the OpenGL info from options in rhino 5:
Here is a video of the same script running side by side in rhino 5 (left) and rhino 6 (right). Video is 80 seconds, it ends when the script is complete in rhino 5.
You can see that redraw is disabled in 5, but not in 6.
Something I noticed only after making this video and watching it - different surfaces are having colour applied to them depending on whether the script is run in 5 or 6! In 5 it’s the upper surfaces that are all magenta (which is correct), in 6 it’s the lower surfaces that are all magenta (which is incorrect).
At first I thought I must have somehow run two different scripts (which is why I quickly edited my post above, now deleted - although at no point have I ever written a version of this script that leaves the bottom surface as magenta), but I have doubled check this behaviour and am 100% certain they are running the same script (I have dragged the same .3dm model file from windows explorer into the rhino windows to open them, and closed all script files in the editors for each, then renamed the script file in explorer to something unusual and unique and then opened it in the editor for 5 and 6 - definitely the same script file.
So now the added difference in behaviour of colour being applied to different surfaces, using the same script file. There is no logic in my script that checks or refers to the rhino version in any way at all.
If you run as shown in Rhino 6 redraw will not be disabled, you’ll see each sphere being individually drawn.
If you comment out the rs.Command line redraw will be disabled as expected.
If you run this in rhino 5 it makes no difference whether the line is commented out or not, redraw is correctly disabled.
From what I can determine, it is actually the Export command itself that is provoking the redraw, not rs.Command(). In my tests here, if I run the rs.Command with something other than Export or SaveAs, no intermediate redraw happens. So this might be a change made to the Export/SaveAs command mechanisms for V6. @dale?
Thanks Mitch for checking this. I have been running into this issue as well and solved it by putting in some extra code lines for redraw disable code. I never found it was th Export command causing it @dale
If possible It would be good to know what commands re-enable the redraw to target only those.