Hi,
We are in the progress of upgrading our plugin from Rhino 7 to Rhino 8. There seem to be some differences in how the Rhino.UI.ProgressBar works in Rhino 8.
For example, the code below works just fine in Rhino 7. Basically it will show an update message and pause for 500ms so you can see it.
Rhino.UI.StatusBar.HideProgressMeter();
var count = 100;
var message = "Test";
var result = Rhino.UI.StatusBar.ShowProgressMeter(0, 100, message + @$" (0/{count})", true, true);
for (int i = 0; i < count; i++)
{
System.Threading.Thread.Sleep(500);
Rhino.UI.StatusBar.HideProgressMeter(); // The line below won't work unless you hide the current message first.
result = Rhino.UI.StatusBar.ShowProgressMeter(0, 100, message + @$" ({i + 1}/{count})", true, true);
result = Rhino.UI.StatusBar.UpdateProgressMeter(i + 1, true);
}
Rhino.UI.StatusBar.HideProgressMeter();
However, in Rhino 8 this code doesn’t work at all. Reviewed the latest RhinoCommon documentation and developer guides for some clues. It seems that using RhinoApp.Wait() or Eto.Forms.Application.Instance.RunInstance() are need in order to update the correct thread. I’m guessing that something changed to how UI updates are handled in Rhino 8.
The code below has been updated so it works again.
Rhino.UI.StatusBar.HideProgressMeter();
var count = 100;
var message = "Test";
var result = Rhino.UI.StatusBar.ShowProgressMeter(0, 100, message + @$" (0/{count})", true, true);
for (int i = 0; i < count; i++)
{
System.Threading.Thread.Sleep(500);
Rhino.UI.StatusBar.HideProgressMeter(); // The line below won't work unless you hide the current message first.
result = Rhino.UI.StatusBar.ShowProgressMeter(0, 100, message + @$" ({i + 1}/{count})", true, true);
result = Rhino.UI.StatusBar.UpdateProgressMeter(i + 1, true);
Eto.Forms.Application.Instance?.RunIteration(); // RhinoApp.Wait() has a similar effect.
}
Rhino.UI.StatusBar.HideProgressMeter();
This does bring the progress panel back again. But there still are some issues with it. If you run it a couple of times you’ll see that it appears to skip some of the ShowProgressMeter updates. In the 100 updates it seems to miss 4-5 of them.
My question is, what is the recommended way to use the ProgressBar in Rhino 8? While the code above is good enough for a patch for now it would be better with something that actually works the way it should. Perhaps this a new bug?
If anyone has a better solution to this I would appreciate your input.


