diff --git a/MatterControlLib/DesignTools/EditorTools/RotateControls/PathControl.cs b/MatterControlLib/DesignTools/EditorTools/RotateControls/PathControl.cs index 416ce781c..c0d4258c2 100644 --- a/MatterControlLib/DesignTools/EditorTools/RotateControls/PathControl.cs +++ b/MatterControlLib/DesignTools/EditorTools/RotateControls/PathControl.cs @@ -193,7 +193,7 @@ namespace MatterHackers.Plugins.EditorTools lastItem = selectedItem; - if (selectedItem is PathObject3D pathObject) + if (selectedItem is PathContainerObject3D pathObject) { var vertexStorage = pathObject.VertexStorage; diff --git a/MatterControlLib/DesignTools/Operations/FindSliceObject3D.cs b/MatterControlLib/DesignTools/Operations/FindSliceObject3D.cs index 8b94d5067..cea15de64 100644 --- a/MatterControlLib/DesignTools/Operations/FindSliceObject3D.cs +++ b/MatterControlLib/DesignTools/Operations/FindSliceObject3D.cs @@ -42,7 +42,7 @@ using Polygons = System.Collections.Generic.List false; + + private double cutMargin = .01; public (Mesh mesh, Polygons polygons) Cut(IObject3D item) { @@ -192,5 +194,10 @@ namespace MatterHackers.MatterControl.DesignTools public void UpdateControls(PublicPropertyChange change) { } - } + + public IVertexSource GetVertexSource() + { + return VertexStorage; + } + } } \ No newline at end of file diff --git a/MatterControlLib/DesignTools/Operations/Image/ImageToPathObject3D.cs b/MatterControlLib/DesignTools/Operations/Image/ImageToPathObject3D.cs index 8e0a06444..22307b72b 100644 --- a/MatterControlLib/DesignTools/Operations/Image/ImageToPathObject3D.cs +++ b/MatterControlLib/DesignTools/Operations/Image/ImageToPathObject3D.cs @@ -55,7 +55,7 @@ using Polygons = System.Collections.Generic.List + /// This is a class that is specifically holding a path and the mesh is a visualization of the path + /// + public class PathObject3D : PathContainerObject3D + { + // Report that the Mesh is a visual representation of the Path and not a solid object + public override bool MeshIsSolidObject => false; + } } \ No newline at end of file diff --git a/MatterControlLib/DesignTools/Operations/Path/InflatePathObject3D.cs b/MatterControlLib/DesignTools/Operations/Path/InflatePathObject3D.cs index 8a67432b9..7f11a67be 100644 --- a/MatterControlLib/DesignTools/Operations/Path/InflatePathObject3D.cs +++ b/MatterControlLib/DesignTools/Operations/Path/InflatePathObject3D.cs @@ -50,7 +50,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations Sharp, } - public class InflatePathObject3D : PathObject3D, IEditorDraw, IObject3DControlsProvider + public class InflatePathObject3D : PathContainerObject3D, IEditorDraw, IObject3DControlsProvider { public InflatePathObject3D() { diff --git a/MatterControlLib/DesignTools/Operations/Path/LinearExtrudeObject3D.cs b/MatterControlLib/DesignTools/Operations/Path/LinearExtrudeObject3D.cs index 164db040b..9829ef18b 100644 --- a/MatterControlLib/DesignTools/Operations/Path/LinearExtrudeObject3D.cs +++ b/MatterControlLib/DesignTools/Operations/Path/LinearExtrudeObject3D.cs @@ -43,7 +43,7 @@ using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.DesignTools.Operations { - public class LinearExtrudeObject3D : PathObject3D, IPrimaryOperationsSpecifier, IPropertyGridModifier + public class LinearExtrudeObject3D : PathContainerObject3D, IPrimaryOperationsSpecifier, IPropertyGridModifier { [Description("The height of the extrusion")] [Slider(.1, 50, Easing.EaseType.Quadratic, useSnappingGrid: true)] diff --git a/MatterControlLib/DesignTools/Operations/Path/MergePathObject3D.cs b/MatterControlLib/DesignTools/Operations/Path/MergePathObject3D.cs index c01001a24..4cfebca7f 100644 --- a/MatterControlLib/DesignTools/Operations/Path/MergePathObject3D.cs +++ b/MatterControlLib/DesignTools/Operations/Path/MergePathObject3D.cs @@ -42,7 +42,7 @@ using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.DesignTools.Operations { - public class MergePathObject3D : OperationSourceContainerObject3D, IEditorDraw, IObject3DControlsProvider, IPrimaryOperationsSpecifier + public class MergePathObject3D : OperationSourceContainerObject3D, IEditorDraw, IObject3DControlsProvider, IPrimaryOperationsSpecifier, IPathObject3D { private ClipperLib.ClipType clipType; private string operationName; @@ -66,6 +66,10 @@ namespace MatterHackers.MatterControl.DesignTools.Operations public override bool CanApply => true; + public bool MeshIsSolidObject => false; + + public VertexStorage VertexStorage { get; set; } + public override void Apply(UndoBuffer undoBuffer) { this.FlattenToPathObject(undoBuffer); @@ -113,14 +117,16 @@ namespace MatterHackers.MatterControl.DesignTools.Operations SourceContainer.Visible = true; RemoveAllButSource(); - var participants = SourceContainer.VisiblePaths(); + var participants = SourceContainer.VisiblePaths2(); + var first = participants.First(); + var firstObject3D = first as Object3D; if (participants.Count() < 2) { if (participants.Count() == 1) { var newMesh = new Object3D(); - newMesh.CopyProperties(participants.First(), Object3DPropertyFlags.All); - newMesh.Mesh = participants.First().Mesh; + newMesh.CopyProperties(firstObject3D, Object3DPropertyFlags.All); + newMesh.Mesh = firstObject3D.Mesh; this.Children.Add(newMesh); SourceContainer.Visible = false; } @@ -128,8 +134,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations return; } - var first = participants.First(); - var resultsVertexSource = first.GetVertexSource().Transform(first.WorldMatrix(this)); + var resultsVertexSource = first.GetVertexSource().Transform(firstObject3D.WorldMatrix(this)); var totalOperations = participants.Count() - 1; double amountPerOperation = 1.0 / totalOperations; @@ -140,7 +145,8 @@ namespace MatterHackers.MatterControl.DesignTools.Operations if (item != first && item.GetVertexSource() != null) { - var itemVertexSource = item.GetVertexSource().Transform(item.WorldMatrix(this)); + var itemObject3D = item as Object3D; + var itemVertexSource = item.GetVertexSource().Transform(itemObject3D.WorldMatrix(this)); resultsVertexSource = resultsVertexSource.MergePaths(itemVertexSource, clipType); @@ -156,7 +162,12 @@ namespace MatterHackers.MatterControl.DesignTools.Operations public IEnumerable GetOperations() { - return PathObject3D.GetOperations(this.GetType()); + return PathContainerObject3D.GetOperations(this.GetType()); + } + + public IVertexSource GetVertexSource() + { + return VertexStorage; } } } diff --git a/MatterControlLib/DesignTools/Operations/Path/OutlinePathObject3D.cs b/MatterControlLib/DesignTools/Operations/Path/OutlinePathObject3D.cs index 267169149..2f86c29ef 100644 --- a/MatterControlLib/DesignTools/Operations/Path/OutlinePathObject3D.cs +++ b/MatterControlLib/DesignTools/Operations/Path/OutlinePathObject3D.cs @@ -45,7 +45,7 @@ using MatterHackers.VectorMath; namespace MatterHackers.MatterControl.DesignTools.Operations { - public class OutlinePathObject3D : PathObject3D, IEditorDraw, IObject3DControlsProvider + public class OutlinePathObject3D : PathContainerObject3D, IEditorDraw, IObject3DControlsProvider { public OutlinePathObject3D() { diff --git a/MatterControlLib/DesignTools/Operations/Path/SmoothPathObject3D.cs b/MatterControlLib/DesignTools/Operations/Path/SmoothPathObject3D.cs index 29a1aab50..7d3e9be6f 100644 --- a/MatterControlLib/DesignTools/Operations/Path/SmoothPathObject3D.cs +++ b/MatterControlLib/DesignTools/Operations/Path/SmoothPathObject3D.cs @@ -44,7 +44,7 @@ using Polygons = System.Collections.Generic.List GetOperations() { - return PathObject3D.GetOperations(this.GetType()); + return PathContainerObject3D.GetOperations(this.GetType()); } } } \ No newline at end of file