QuadRemeshBrepAsync progress report

CancellationToken token = new CancellationToken();
IProgress<int> progress = new Progress<int>(s=>Rhino.RhinoApp.WriteLine($"Computing {s}")); 
ResultMesh = await Mesh.QuadRemeshBrepAsync(BrepToMesh, quad, progress, token);

This will only report “0” and then nothing more. Is this an incorrect way to call the method or is the progress report not implemented on the quad remesh side ?

if this is from within a command you’ll want to await from within a Rhino GetCancel()

var gc = new GetCancel();
var rc = gc.Wait(qrMeshTask, Document);

At that point your progress event should start reporting while the get cancel is awaiting.

  var progress = new Progress<int>(percent =>
              StatusBar.UpdateProgressMeter(percent, true);

Unfortunately I’m meshing a brep which is not added yet to a document, running the code from a custom rhino panel…

The GetCancel should still run and will accept your esc attempts. This is how the QuadRemesh modal dialog awaits the previews.

1 Like