Rhino 6 doesn't respond while doing long computation - C++

Hello,

We have a plugin for Rhino 6 for Windows developed using the C++ SDK. We do an operation that takes 5-10 minutes to compute, and we are making use of the TBB library to parallelize. We have implemented as well the progressbar (using StatusBarProgressMeter methods). When running on debug from Visual Studio, the user cannot interact with the scene but Rhino updates the progress bar (which is the behavior that we’re looking for).

When we run the plugin without visual studio (building the .rhp as Release/Debug), after some iterations of our algorithm, Rhino hangs (the window turns white and the title bar contains “no responding”) and the progress bar doesn’t update. After 5-10 mins, our algorithm completes and we get the expected result.

We have tried to run the algorithm on a separate thread using std::thread, but we observe the same behavior. Any ideas to prevent that from happening?

Thanks,

Pau

Hi Pau,

To keep Rhino’s user interface alive during time consuming tasks, sprinkle the following statement throughout your code:

RhinoApp().Wait(0);

This “peeks and pumps” the Windows message queue, giving Rhino a chance to process mouse movements, etc., thus keeping reponding during the task.

Hope this helps.

– Dale

Hi Dale,

That did the trick, thanks!

Pau