From 2aafec3f1338df7fc70a2ad046e900b1f381ca76 Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Mon, 26 Mar 2018 17:52:16 -0700 Subject: [PATCH 1/5] Improving the csg tests --- .../MatterControl/MeshCsgTests.cs | 76 +++++++++++++++---- 1 file changed, 60 insertions(+), 16 deletions(-) diff --git a/Tests/MatterControl.Tests/MatterControl/MeshCsgTests.cs b/Tests/MatterControl.Tests/MatterControl/MeshCsgTests.cs index 44d98885b..d6c01e6e1 100644 --- a/Tests/MatterControl.Tests/MatterControl/MeshCsgTests.cs +++ b/Tests/MatterControl.Tests/MatterControl/MeshCsgTests.cs @@ -61,27 +61,43 @@ namespace MatterHackers.PolygonMesh.UnitTests // check that we subtarct two 3 sideh cylinders { + double topHeight = 10; int sides = 3; - IObject3D keep = CylinderAdvancedObject3D.Create(20, 20, sides); - IObject3D subtract = CylinderAdvancedObject3D.Create(10, 20, sides); + IObject3D keep = CylinderAdvancedObject3D.Create(20, topHeight*2, sides); + IObject3D subtract = CylinderAdvancedObject3D.Create(10, topHeight*2, sides); var keepMesh = keep.Mesh; var subtractMesh = subtract.Mesh; var split1 = new DebugFace() { - EvaluateHeight = 10, + EvaluateHeight = topHeight, FileName = "Split1" }; - var resultMesh = keepMesh.Subtract(subtractMesh, null, CancellationToken.None);//, - //split1.Split, split1.Result); + var resultMesh = keepMesh.Subtract(subtractMesh, null, CancellationToken.None, + split1.Split, split1.Result); // this is for debuging the opperation - //split1.FinishOutput(); - //resultMesh.Save("c:/temp/mesh1.stl", CancellationToken.None); + split1.FinishOutput(); + resultMesh.Save("c:/temp/mesh1.stl", CancellationToken.None); - Assert.AreEqual(12, CountFacesAtHeight(keepMesh, 10)); + if (false) + { + var topZero = new Vector3(0, 0, topHeight); + foreach (var topVertex in keepMesh.Vertices + .Where((v) => v.Position.Z == topHeight && v.Position != topZero) + .Select((gv) => gv.Position)) + { + Assert.IsTrue(resultMesh.Vertices.Where((v) => v.Position == topVertex).Any(), "Have all top vertexes"); + } + foreach (var topVertex in subtractMesh.Vertices + .Where((v) => v.Position.Z == topHeight && v.Position != topZero) + .Select((gv) => gv.Position)) + { + Assert.IsTrue(resultMesh.Vertices.Where((v) => v.Position == topVertex).Any(), "Have all top vertexes"); + } + } } // check that we subtarct two 3 sideh cylinders @@ -99,21 +115,49 @@ namespace MatterHackers.PolygonMesh.UnitTests FileName = "Split2" }; - var resultMesh = keepMesh.Subtract(subtractMesh, null, CancellationToken.None);//, - //split1.Split, split1.Result); + var resultMesh = keepMesh.Subtract(subtractMesh, null, CancellationToken.None, + split1.Split, split1.Result); // this is for debuging the opperation - //split1.FinishOutput(); - //esultMesh.Save("c:/temp/mesh2.stl", CancellationToken.None); + split1.FinishOutput(); + resultMesh.Save("c:/temp/mesh2.stl", CancellationToken.None); - Assert.AreEqual(12, CountFacesAtHeight(keepMesh, 10)); + #if false + { + var topZero = new Vector3(0, 0, topHeight); + foreach (var topVertex in keepMesh.Vertices + .Where((v) => v.Position.Z == topHeight && v.Position != topZero) + .Select((gv) => gv.Position)) + { + Assert.IsTrue(resultMesh.Vertices.Where((v) => v.Position == topVertex).Any(), "Have all top vertexes"); + } + foreach (var topVertex in subtractMesh.Vertices + .Where((v) => v.Position.Z == topHeight && v.Position != topZero) + .Select((gv) => gv.Position)) + { + Assert.IsTrue(resultMesh.Vertices.Where((v) => v.Position == topVertex).Any(), "Have all top vertexes"); + } + } +#endif } } - private double CountFacesAtHeight(Mesh keepMesh, double zHeightToFind) + private double CountFacesAtHeight(Mesh keepMesh, double zHeight) { - // TODO: make this work - return 12; + int count = 0; + foreach (var face in keepMesh.Faces) + { + var triangles = face.AsTriangles().ToList(); + if (DebugFace.FaceAtHeight(new Vector3[] + { + triangles[0].p0,triangles[0].p1,triangles[0].p2, + }, zHeight)) + { + count++; + } + } + + return count; } } From 3043c7c800847a2cc8fd1b8552fd6e963a0d2819 Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Wed, 28 Mar 2018 09:28:36 -0700 Subject: [PATCH 2/5] Working on new csg test --- Submodules/agg-sharp | 2 +- .../MatterControl.Tests.csproj | 4 + .../MatterControl/MeshCsgTests.cs | 220 ++++++++++++------ 3 files changed, 151 insertions(+), 75 deletions(-) diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index ed0cd4a86..40765a944 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit ed0cd4a8625acf26eb41cb45f430a03049ea577e +Subproject commit 40765a9441a89303a4d11acee72891b059859925 diff --git a/Tests/MatterControl.Tests/MatterControl.Tests.csproj b/Tests/MatterControl.Tests/MatterControl.Tests.csproj index eae17513c..379af7542 100644 --- a/Tests/MatterControl.Tests/MatterControl.Tests.csproj +++ b/Tests/MatterControl.Tests/MatterControl.Tests.csproj @@ -127,6 +127,10 @@ {670BDDFF-927B-425D-9DD1-22ACB14356EB} PlatformWin32 + + {7ee4636d-8a92-4015-9562-7fcd6add0645} + Net3dBool + {86F6AAF2-9B50-40B8-A427-1897D76471C5} PolygonMesh diff --git a/Tests/MatterControl.Tests/MatterControl/MeshCsgTests.cs b/Tests/MatterControl.Tests/MatterControl/MeshCsgTests.cs index d6c01e6e1..11e501e64 100644 --- a/Tests/MatterControl.Tests/MatterControl/MeshCsgTests.cs +++ b/Tests/MatterControl.Tests/MatterControl/MeshCsgTests.cs @@ -43,6 +43,7 @@ using MatterHackers.MatterControl.Tests.Automation; using MatterHackers.PolygonMesh.Csg; using MatterHackers.PolygonMesh.Processors; using MatterHackers.VectorMath; +using Net3dBool; using NUnit.Framework; namespace MatterHackers.PolygonMesh.UnitTests @@ -51,7 +52,7 @@ namespace MatterHackers.PolygonMesh.UnitTests public class MeshCsgTests { [Test] - public void CylinderMinusCylinder() + public void CsgCylinderMinusCylinder() { AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData")); MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4)); @@ -63,8 +64,8 @@ namespace MatterHackers.PolygonMesh.UnitTests { double topHeight = 10; int sides = 3; - IObject3D keep = CylinderAdvancedObject3D.Create(20, topHeight*2, sides); - IObject3D subtract = CylinderAdvancedObject3D.Create(10, topHeight*2, sides); + IObject3D keep = CylinderAdvancedObject3D.Create(20, topHeight * 2, sides); + IObject3D subtract = CylinderAdvancedObject3D.Create(10, topHeight * 2, sides); var keepMesh = keep.Mesh; var subtractMesh = subtract.Mesh; @@ -75,28 +76,30 @@ namespace MatterHackers.PolygonMesh.UnitTests FileName = "Split1" }; - var resultMesh = keepMesh.Subtract(subtractMesh, null, CancellationToken.None, - split1.Split, split1.Result); + BooleanModeller.Object1SplitFace = split1.Split; + BooleanModeller.Object1SplitResults = split1.Result; + + BooleanModeller.Object1ClassifyFace = split1.Classify1; + BooleanModeller.Object2ClassifyFace = split1.Classify2; + + var resultMesh = keepMesh.Subtract(subtractMesh, null, CancellationToken.None); // this is for debuging the opperation split1.FinishOutput(); resultMesh.Save("c:/temp/mesh1.stl", CancellationToken.None); - if (false) + var topZero = new Vector3(0, 0, topHeight); + foreach (var topVertex in keepMesh.Vertices + .Where((v) => v.Position.Z == topHeight && v.Position != topZero) + .Select((gv) => gv.Position)) { - var topZero = new Vector3(0, 0, topHeight); - foreach (var topVertex in keepMesh.Vertices - .Where((v) => v.Position.Z == topHeight && v.Position != topZero) - .Select((gv) => gv.Position)) - { - Assert.IsTrue(resultMesh.Vertices.Where((v) => v.Position == topVertex).Any(), "Have all top vertexes"); - } - foreach (var topVertex in subtractMesh.Vertices - .Where((v) => v.Position.Z == topHeight && v.Position != topZero) - .Select((gv) => gv.Position)) - { - Assert.IsTrue(resultMesh.Vertices.Where((v) => v.Position == topVertex).Any(), "Have all top vertexes"); - } + Assert.IsTrue(resultMesh.Vertices.Where((v) => v.Position == topVertex).Any(), "Have all top vertexes"); + } + foreach (var topVertex in subtractMesh.Vertices + .Where((v) => v.Position.Z == topHeight && v.Position != topZero) + .Select((gv) => gv.Position)) + { + Assert.IsTrue(resultMesh.Vertices.Where((v) => v.Position == topVertex).Any(), "Have all top vertexes"); } } @@ -104,7 +107,7 @@ namespace MatterHackers.PolygonMesh.UnitTests { int sides = 3; IObject3D keep = CylinderAdvancedObject3D.Create(20, 20, sides); - IObject3D subtract = CylinderAdvancedObject3D.Create(10, 21, sides); + IObject3D subtract = CylinderAdvancedObject3D.Create(10, 22, sides); var keepMesh = keep.Mesh; var subtractMesh = subtract.Mesh; @@ -115,56 +118,40 @@ namespace MatterHackers.PolygonMesh.UnitTests FileName = "Split2" }; - var resultMesh = keepMesh.Subtract(subtractMesh, null, CancellationToken.None, - split1.Split, split1.Result); + BooleanModeller.Object1SplitFace = split1.Split; + BooleanModeller.Object1SplitResults = split1.Result; + + var resultMesh = keepMesh.Subtract(subtractMesh, null, CancellationToken.None); // this is for debuging the opperation split1.FinishOutput(); resultMesh.Save("c:/temp/mesh2.stl", CancellationToken.None); - #if false + foreach (var topVertex in keepMesh.Vertices + .Where((v) => v.Position.Z == 10 && v.Position != new Vector3(0, 0, 10)) + .Select((gv) => gv.Position)) { - var topZero = new Vector3(0, 0, topHeight); - foreach (var topVertex in keepMesh.Vertices - .Where((v) => v.Position.Z == topHeight && v.Position != topZero) - .Select((gv) => gv.Position)) - { - Assert.IsTrue(resultMesh.Vertices.Where((v) => v.Position == topVertex).Any(), "Have all top vertexes"); - } - foreach (var topVertex in subtractMesh.Vertices - .Where((v) => v.Position.Z == topHeight && v.Position != topZero) - .Select((gv) => gv.Position)) - { - Assert.IsTrue(resultMesh.Vertices.Where((v) => v.Position == topVertex).Any(), "Have all top vertexes"); - } + Assert.IsTrue(resultMesh.Vertices.Where((v) => v.Position == topVertex).Any(), "Have all top vertexes"); } -#endif - } - } - - private double CountFacesAtHeight(Mesh keepMesh, double zHeight) - { - int count = 0; - foreach (var face in keepMesh.Faces) - { - var triangles = face.AsTriangles().ToList(); - if (DebugFace.FaceAtHeight(new Vector3[] + foreach (var topVertex in subtractMesh.Vertices + .Where((v) => v.Position.Z == 11 && v.Position != new Vector3(0, 0, 11)) + .Select((gv) => gv.Position)) { - triangles[0].p0,triangles[0].p1,triangles[0].p2, - }, zHeight)) - { - count++; + Assert.IsTrue(resultMesh.Vertices + .Where((v) => v.Position.Equals(new Vector3(topVertex.X, topVertex.Y, 10), .0001)) + .Any(), "Have all top vertexes"); } } - - return count; } } public class DebugFace { private int currentIndex; - private StringBuilder allPolygonDebug = new StringBuilder(); + private StringBuilder allSplitPolygonDebug = new StringBuilder(); + private StringBuilder allResultsPolygonDebug = new StringBuilder(); + private StringBuilder classifiedFaces1 = new StringBuilder(); + private StringBuilder classifiedFaces2 = new StringBuilder(); private StringBuilder htmlContent = new StringBuilder(); private StringBuilder individualPolygonDebug = new StringBuilder(); @@ -175,7 +162,7 @@ namespace MatterHackers.PolygonMesh.UnitTests Vector2 offset = new Vector2(10, 18); double scale = 13; - public void Result(List splitResults) + public void Result(List splitResults) { if (splitResults.Count > 0 && FaceAtHeight(splitResults[0], EvaluateHeight)) @@ -185,19 +172,17 @@ namespace MatterHackers.PolygonMesh.UnitTests foreach (var face in splitResults) { individualPolygonDebug.AppendLine(GetCoords(face)); + allResultsPolygonDebug.AppendLine(GetCoords(face)); } individualPolygonDebug.AppendLine(""); } } - public void Split(Vector3[] faceToSplit, Vector3[] splitAtFace) + public void Split(CsgFace faceToSplit, CsgFace splitAtFace) { if (FaceAtHeight(faceToSplit, EvaluateHeight)) { - string faceToSplitCoords = GetCoords(faceToSplit); - string splitAtFaceCoords = GetCoords(splitAtFace); - - allPolygonDebug.AppendLine(faceToSplitCoords); + allSplitPolygonDebug.AppendLine(GetCoords(faceToSplit)); if (currentIndex == 0) { @@ -210,22 +195,32 @@ namespace MatterHackers.PolygonMesh.UnitTests currentIndex++; individualPolygonDebug.AppendLine($"
{currentIndex}
"); individualPolygonDebug.AppendLine($""); - individualPolygonDebug.AppendLine(faceToSplitCoords); - individualPolygonDebug.AppendLine(splitAtFaceCoords); + individualPolygonDebug.AppendLine(GetCoords(faceToSplit)); + individualPolygonDebug.AppendLine(GetCoords(splitAtFace)); individualPolygonDebug.AppendLine(""); } } public void FinishOutput() { - htmlContent.AppendLine($""); - - htmlContent.Append(allPolygonDebug.ToString()); + htmlContent.AppendLine($""); + htmlContent.Append(allSplitPolygonDebug.ToString()); + htmlContent.AppendLine(""); + htmlContent.AppendLine($""); + htmlContent.Append(allResultsPolygonDebug.ToString()); htmlContent.AppendLine(""); htmlContent.Append(individualPolygonDebug.ToString()); + htmlContent.AppendLine($""); + htmlContent.Append(classifiedFaces1.ToString()); + htmlContent.AppendLine(""); + + htmlContent.AppendLine($""); + htmlContent.Append(classifiedFaces2.ToString()); + htmlContent.AppendLine(""); + htmlContent.AppendLine(""); htmlContent.AppendLine(""); @@ -243,19 +238,19 @@ namespace MatterHackers.PolygonMesh.UnitTests return false; } - public static bool FaceAtHeight(Vector3[] face, double height) + public static bool FaceAtHeight(CsgFace face, double height) { - if (!AreEqual(face[0].Z, height)) + if (!AreEqual(face.v1.Position.Z, height)) { return false; } - if (!AreEqual(face[1].Z, height)) + if (!AreEqual(face.v2.Position.Z, height)) { return false; } - if (!AreEqual(face[2].Z, height)) + if (!AreEqual(face.v3.Position.Z, height)) { return false; } @@ -286,15 +281,20 @@ namespace MatterHackers.PolygonMesh.UnitTests return true; } - public string GetCoords(Vector3[] face) + public string GetCoords(CsgFace face) { - Vector2 p1 = (new Vector2(face[0].X, -face[0].Y) + offset) * scale; - Vector2 p2 = (new Vector2(face[1].X, -face[1].Y) + offset) * scale; - Vector2 p3 = (new Vector2(face[2].X, -face[2].Y) + offset) * scale; + return GetCoords(face, Color.Black, new Color(Color.Red, 100)); + } + + public string GetCoords(CsgFace face, Color strokeColor, Color fillColor, double lineWidth = 1) + { + Vector2 p1 = (new Vector2(face.v1.Position.X, -face.v1.Position.Y) + offset) * scale; + Vector2 p2 = (new Vector2(face.v2.Position.X, -face.v2.Position.Y) + offset) * scale; + Vector2 p3 = (new Vector2(face.v3.Position.X, -face.v3.Position.Y) + offset) * scale; string coords = $"{p1.X:0.0}, {p1.Y:0.0}"; coords += $", {p2.X:0.0}, {p2.Y:0.0}"; coords += $", {p3.X:0.0}, {p3.Y:0.0}"; - return $""; + return $""; } public static bool HasPosition(Vector3[] face, Vector3 position) @@ -314,5 +314,77 @@ namespace MatterHackers.PolygonMesh.UnitTests return false; } + + public void Classify1(CsgFace face) + { + //if (FaceAtHeight(face, EvaluateHeight)) + { + Color color = new Color(); + switch (face.Status) + { + case FaceStatus.Unknown: + color = Color.Cyan; + break; + case FaceStatus.Inside: + color = Color.Green; + break; + case FaceStatus.Outside: + color = Color.Red; + break; + case FaceStatus.Same: + color = Color.Gray; + break; + case FaceStatus.Opposite: + color = Color.Yellow; + break; + case FaceStatus.Boundary: + color = Color.Indigo; + break; + default: + throw new NotImplementedException(); + } + + // make it transparent + color = new Color(color, 100); + + classifiedFaces1.AppendLine(GetCoords(face, Color.Black, color)); + } + } + + public void Classify2(CsgFace face) + { + if (FaceAtHeight(face, EvaluateHeight)) + { + Color color = new Color(); + switch (face.Status) + { + case FaceStatus.Unknown: + color = Color.Cyan; + break; + case FaceStatus.Inside: + color = Color.Green; + break; + case FaceStatus.Outside: + color = Color.Red; + break; + case FaceStatus.Same: + color = Color.Gray; + break; + case FaceStatus.Opposite: + color = Color.Yellow; + break; + case FaceStatus.Boundary: + color = Color.Indigo; + break; + default: + throw new NotImplementedException(); + } + + // make it transparent + color = new Color(color, 100); + + classifiedFaces2.AppendLine(GetCoords(face, Color.Black, color)); + } + } } } \ No newline at end of file From 65c407929d39932418a93fd1b9f829e3d7f21c6e Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Wed, 28 Mar 2018 14:48:01 -0700 Subject: [PATCH 3/5] Improved subtract and replace feedback Make sure we don't turn off heat while printing if had a off delay --- .../View3D/Actions/SubtractAndReplace.cs | 14 +++++++++++++- PartPreviewWindow/View3D/Actions/SubtractEditor.cs | 4 ++-- PrinterCommunication/PrinterConnection.cs | 4 +++- Submodules/agg-sharp | 2 +- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/PartPreviewWindow/View3D/Actions/SubtractAndReplace.cs b/PartPreviewWindow/View3D/Actions/SubtractAndReplace.cs index a53b76ecf..ca14d8f27 100644 --- a/PartPreviewWindow/View3D/Actions/SubtractAndReplace.cs +++ b/PartPreviewWindow/View3D/Actions/SubtractAndReplace.cs @@ -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); diff --git a/PartPreviewWindow/View3D/Actions/SubtractEditor.cs b/PartPreviewWindow/View3D/Actions/SubtractEditor.cs index 1a7a15e2e..3186760ce 100644 --- a/PartPreviewWindow/View3D/Actions/SubtractEditor.cs +++ b/PartPreviewWindow/View3D/Actions/SubtractEditor.cs @@ -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"; diff --git a/PrinterCommunication/PrinterConnection.cs b/PrinterCommunication/PrinterConnection.cs index feb5300f6..74c8b4e58 100644 --- a/PrinterCommunication/PrinterConnection.cs +++ b/PrinterCommunication/PrinterConnection.cs @@ -2466,7 +2466,9 @@ namespace MatterHackers.MatterControl.PrinterCommunication } // times up turn off heaters - if (ContinuWaitingToTurnOffHeaters) + if (ContinuWaitingToTurnOffHeaters + && !PrinterIsPrinting + && !PrinterIsPaused) { UiThread.RunOnIdle(() => { diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 40765a944..1d2662586 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 40765a9441a89303a4d11acee72891b059859925 +Subproject commit 1d2662586a48a8abffc622ef1071f301000e9ead From ae192d9157814d590ce3aa3a31593a802fefc447 Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Wed, 28 Mar 2018 15:22:03 -0700 Subject: [PATCH 4/5] latest agg and ms --- Submodules/MatterSlice | 2 +- Submodules/agg-sharp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Submodules/MatterSlice b/Submodules/MatterSlice index 6cb7f7949..3ca863d64 160000 --- a/Submodules/MatterSlice +++ b/Submodules/MatterSlice @@ -1 +1 @@ -Subproject commit 6cb7f7949ccfc62096bf5a3cbedc39fe8fe56ece +Subproject commit 3ca863d643ff47053e74424efd13db13048c7892 diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 1d2662586..39695a622 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 1d2662586a48a8abffc622ef1071f301000e9ead +Subproject commit 39695a622650ffd4abdbe5de2921675104e94b78 From f46ea60525cc710d0319f5740ba01166624f4edf Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Wed, 28 Mar 2018 17:30:31 -0700 Subject: [PATCH 5/5] Make the test not save --- .../MatterControl/MeshCsgTests.cs | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/Tests/MatterControl.Tests/MatterControl/MeshCsgTests.cs b/Tests/MatterControl.Tests/MatterControl/MeshCsgTests.cs index 11e501e64..47bdf5a9e 100644 --- a/Tests/MatterControl.Tests/MatterControl/MeshCsgTests.cs +++ b/Tests/MatterControl.Tests/MatterControl/MeshCsgTests.cs @@ -70,23 +70,26 @@ namespace MatterHackers.PolygonMesh.UnitTests var keepMesh = keep.Mesh; var subtractMesh = subtract.Mesh; - var split1 = new DebugFace() + if (false) { - EvaluateHeight = topHeight, - FileName = "Split1" - }; + var split1 = new DebugFace() + { + EvaluateHeight = topHeight, + FileName = "Split1" + }; - BooleanModeller.Object1SplitFace = split1.Split; - BooleanModeller.Object1SplitResults = split1.Result; + BooleanModeller.Object1SplitFace = split1.Split; + BooleanModeller.Object1SplitResults = split1.Result; - BooleanModeller.Object1ClassifyFace = split1.Classify1; - BooleanModeller.Object2ClassifyFace = split1.Classify2; + BooleanModeller.Object1ClassifyFace = split1.Classify1; + BooleanModeller.Object2ClassifyFace = split1.Classify2; + } var resultMesh = keepMesh.Subtract(subtractMesh, null, CancellationToken.None); // this is for debuging the opperation - split1.FinishOutput(); - resultMesh.Save("c:/temp/mesh1.stl", CancellationToken.None); + //split1.FinishOutput(); + //resultMesh.Save("c:/temp/mesh1.stl", CancellationToken.None); var topZero = new Vector3(0, 0, topHeight); foreach (var topVertex in keepMesh.Vertices @@ -112,20 +115,23 @@ namespace MatterHackers.PolygonMesh.UnitTests var keepMesh = keep.Mesh; var subtractMesh = subtract.Mesh; - var split1 = new DebugFace() + if (false) { - EvaluateHeight = 10, - FileName = "Split2" - }; + var split1 = new DebugFace() + { + EvaluateHeight = 10, + FileName = "Split2" + }; - BooleanModeller.Object1SplitFace = split1.Split; - BooleanModeller.Object1SplitResults = split1.Result; + BooleanModeller.Object1SplitFace = split1.Split; + BooleanModeller.Object1SplitResults = split1.Result; + } var resultMesh = keepMesh.Subtract(subtractMesh, null, CancellationToken.None); // this is for debuging the opperation - split1.FinishOutput(); - resultMesh.Save("c:/temp/mesh2.stl", CancellationToken.None); + //split1.FinishOutput(); + //resultMesh.Save("c:/temp/mesh2.stl", CancellationToken.None); foreach (var topVertex in keepMesh.Vertices .Where((v) => v.Position.Z == 10 && v.Position != new Vector3(0, 0, 10))