Improved subtract and replace feedback

Make sure we don't turn off heat while printing if had a off delay
This commit is contained in:
Lars Brubaker 2018-03-28 14:48:01 -07:00
parent 3043c7c800
commit 65c407929d
4 changed files with 19 additions and 5 deletions

View file

@ -209,6 +209,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
if (paintObjects.Any()
&& keepObjects.Any())
{
var totalOperations = paintObjects.Count * keepObjects.Count;
double amountPerOperation = 1.0 / totalOperations;
double percentCompleted = 0;
foreach (var paint in paintObjects)
{
var transformedPaint = Mesh.Copy(paint.Mesh, cancellationToken);
@ -223,7 +227,15 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
transformedKeep.Transform(keep.WorldMatrix());
// remove the paint from the original
var intersectAndSubtract = PolygonMesh.Csg.CsgOperations.IntersectAndSubtract(transformedKeep, transformedPaint);
var intersectAndSubtract = PolygonMesh.Csg.CsgOperations.IntersectAndSubtract(transformedKeep, transformedPaint, (status, progress0To1) =>
{
// Abort if flagged
cancellationToken.ThrowIfCancellationRequested();
progressStatus.Status = status;
progressStatus.Progress0To1 = percentCompleted + amountPerOperation * progress0To1;
reporter?.Report(progressStatus);
}, cancellationToken);
var inverseKeep = keep.WorldMatrix();
inverseKeep.Invert();
intersectAndSubtract.subtract.Transform(inverseKeep);

View file

@ -216,12 +216,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
{
progressStatus.Status = "Copy Remove";
reporter?.Report(progressStatus);
var transformedRemove = Mesh.Copy(remove.Mesh, CancellationToken.None);
var transformedRemove = Mesh.Copy(remove.Mesh, cancellationToken);
transformedRemove.Transform(remove.WorldMatrix());
progressStatus.Status = "Copy Keep";
reporter?.Report(progressStatus);
var transformedKeep = Mesh.Copy(keep.Mesh, CancellationToken.None);
var transformedKeep = Mesh.Copy(keep.Mesh, cancellationToken);
transformedKeep.Transform(keep.WorldMatrix());
progressStatus.Status = "Do CSG";

View file

@ -2466,7 +2466,9 @@ namespace MatterHackers.MatterControl.PrinterCommunication
}
// times up turn off heaters
if (ContinuWaitingToTurnOffHeaters)
if (ContinuWaitingToTurnOffHeaters
&& !PrinterIsPrinting
&& !PrinterIsPaused)
{
UiThread.RunOnIdle(() =>
{

@ -1 +1 @@
Subproject commit 40765a9441a89303a4d11acee72891b059859925
Subproject commit 1d2662586a48a8abffc622ef1071f301000e9ead