diff --git a/MatterControlLib/PartPreviewWindow/View3D/Actions/CombineObject3D_2.cs b/MatterControlLib/PartPreviewWindow/View3D/Actions/CombineObject3D_2.cs index c1d57c535..b8b264048 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/Actions/CombineObject3D_2.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/Actions/CombineObject3D_2.cs @@ -147,15 +147,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D var totalOperations = touchingSets.Sum(t => t.Count); -#if false - var resultsMesh = BooleanProcessing.DoArray(items, - CsgModes.Union, - Processing, - InputResolution, - OutputResolution, - reporter, - cancellationToken); -#else double amountPerOperation = 1.0 / totalOperations; double ratioCompleted = 0; @@ -169,6 +160,16 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D if (set.Count > 1) { +#if false + setMesh = BooleanProcessing.DoArray(set.Select(i => (i.mesh, i.matrix)), + CsgModes.Union, + Processing, + InputResolution, + OutputResolution, + reporter, + cancellationToken); +#else + bool first = true; foreach (var next in set) { @@ -203,6 +204,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D progressStatus.Progress0To1 = ratioCompleted; reporter?.Report(progressStatus); } +#endif setMeshes.Add(setMesh); } @@ -229,7 +231,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D resultsMesh.CopyAllFaces(setMesh, Matrix4X4.Identity); } } -#endif if (resultsMesh != null) { diff --git a/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractObject3D_2.cs b/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractObject3D_2.cs index 9d7dcbaf9..22135eb91 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractObject3D_2.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/Actions/SubtractObject3D_2.cs @@ -257,7 +257,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D foreach (var keep in keepItems) { #if false - var items = removeVisibleItems.Select(i => (i.Mesh, i.WorldMatrix(SourceContainer))).ToList(); + var items = removeItems.Select(i => (i.Mesh, i.WorldMatrix(SourceContainer))).ToList(); items.Insert(0, (keep.Mesh, keep.Matrix)); var resultsMesh = BooleanProcessing.DoArray(items, CsgModes.Subtract, diff --git a/MatterControlLib/PartPreviewWindow/View3D/View3DWidget.cs b/MatterControlLib/PartPreviewWindow/View3D/View3DWidget.cs index 9cd362eef..bdf58848b 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/View3DWidget.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/View3DWidget.cs @@ -748,7 +748,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow Tuple nearFar = null; foreach (var aabb in Object3DControlLayer.MakeListOfObjectControlBoundingBoxes()) { - nearFar = ExpandNearAndFarToClippedBounds(nearFar, world.IsOrthographic, worldspacePlanes, world.ModelviewMatrix, aabb); + if (!double.IsNaN(aabb.MinXYZ.X) && !double.IsInfinity(aabb.MinXYZ.X)) + { + nearFar = ExpandNearAndFarToClippedBounds(nearFar, world.IsOrthographic, worldspacePlanes, world.ModelviewMatrix, aabb); + } } nearFar = ExpandNearAndFarToClippedBounds(nearFar, world.IsOrthographic, worldspacePlanes, world.ModelviewMatrix, Object3DControlLayer.GetPrinterNozzleAABB()); nearFar = ExpandNearAndFarToClippedBounds(nearFar, world.IsOrthographic, worldspacePlanes, world.ModelviewMatrix, Scene.GetAxisAlignedBoundingBox());