Animation - Display Conduit

Hi

I am trying to generate simple animation/simulation of 3D objects that are rendered using a display conduit. I am using the old .NET SDK (not RhinoCommon).

The problem is that when I call doc.regen in a loop, it doesn’t behave synchronously. The loop finishes before the animation has finished, and then the display jumps to the final state/transformation.

I have see the sample plugin in the wiki (TestAnimator); our code is structured similarly. However in that example the animation is GUI driven. We also often use the MouseMove of the GetPoint to animate interactions and that works. The problem exists when we have a fast loop.

Is there any built-in way to wait for one rendering to finish before sending the next doc.regen?
It would also help if you could give me an idea of how the doc.regen works internally.

Thank you.

Stratos

You probably need to call

RhUtil.RhinoApp().Wait(0);

right after calling Regen. Regen places a paint message on the windows message queue, and wait let’s Rhino get messages from the queue and process them.

1 Like

Thank you! This did make things better indeed. I had not used this before; it seems very useful…

I searched GitHub-mcneel for uses of the function and I found this one:

Could you please give me an idea of why these calls are used:

// Prevent capturing of the frame buffer on every update
MRhinoDisplayPipeline.EnableFrameBufferCapture(false);
// Prevent the draw list from updating on every frame
dp.FreezeDrawing(true);

Are they relevant when using a display conduit for drawing?

Thank you.

I don’t think those are needed anymore. That seems like V4 legacy code.

Good. Thanks!