Scriptcontex.doc.views.redraw rather slow


I wrote a program for robotic simulations with RhinoCommon.
The drawing threads just calls scriptcontext.doc.Views.Redraw() and the robot and tool meshes are drawed inside the callback called Rhino.Display.DisplayPipeline.PostDrawObjects. When I run the simulation 80% of the time is consumed inside scriptcontext.doc.Views.Redraw() while only 5% in my Callback function. Is there a way to speed up such a scenario in RhinoCommon? Is there a way to speed up this in C++?

(Steve Baer) #2

Threads? Viewport drawing should not be called on separate threads.

Without any extra information it is going to be really hard to tell if there is anything that could be done to improve performance. I highly doubt that changing programming languages is going to make a difference. I’ll need some sort of sample or extra explanation of what is going on.



Hi Steve,
-I need threads because I want to interrupt simulation from my GUI. I never experienced any problems using threads and drawing.
-I suggested C++ because I thought RhinoCommon is still a subset of the native API.
-I wrote a script which does some (2.3 KB)
-empty Doc output on my Computer:
_draw 0.174980163574
bbox 0.13404083252
redraw 21.5271759033
test 21.7192382813
_draw 400
bbox 400
redraw 100
test 1
-On a real Document I get:
_draw 0.0279998779297
bbox 0.0149993896484
redraw 0.0279846191406
test 26.1985015869
_draw 100
bbox 100
redraw 100
test 1


Somhow I have a huge speed gain by switching in
DocumentProperties->Views->OpenGL all flags off. I have now ok values.
I have now
_draw 0.0290069580078
bbox 0.0160217285156
redraw 1.04265594482
test 1.09062957764
_draw 100
bbox 100
redraw 100
test 1


I only have onboard graphics. With a real graphics card Hardware accelleration does not seem to be a problem.