More path work
This commit is contained in:
parent
a22301101d
commit
030a81e9bc
14 changed files with 53 additions and 26 deletions
|
|
@ -193,7 +193,7 @@ namespace MatterHackers.Plugins.EditorTools
|
|||
|
||||
lastItem = selectedItem;
|
||||
|
||||
if (selectedItem is PathObject3D pathObject)
|
||||
if (selectedItem is PathContainerObject3D pathObject)
|
||||
{
|
||||
var vertexStorage = pathObject.VertexStorage;
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ using Polygons = System.Collections.Generic.List<System.Collections.Generic.List
|
|||
|
||||
namespace MatterHackers.MatterControl.DesignTools
|
||||
{
|
||||
public class FindSliceObject3D : OperationSourceContainerObject3D, IPropertyGridModifier
|
||||
public class FindSliceObject3D : OperationSourceContainerObject3D, IPropertyGridModifier, IPathObject3D
|
||||
{
|
||||
public FindSliceObject3D()
|
||||
{
|
||||
|
|
@ -50,9 +50,11 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
}
|
||||
|
||||
public double SliceHeight { get; set; } = 10;
|
||||
public VertexStorage VertexStorage { get; set; }
|
||||
|
||||
|
||||
private double cutMargin = .01;
|
||||
public bool MeshIsSolidObject => 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -55,7 +55,7 @@ using Polygons = System.Collections.Generic.List<System.Collections.Generic.List
|
|||
namespace MatterHackers.MatterControl.DesignTools
|
||||
{
|
||||
[Obsolete("Use ImageToPathObject3D_2 instead", false)]
|
||||
public class ImageToPathObject3D : PathObject3D, IEditorDraw, IObject3DControlsProvider
|
||||
public class ImageToPathObject3D : PathContainerObject3D, IEditorDraw, IObject3DControlsProvider
|
||||
{
|
||||
private ThresholdFunctions _featureDetector = ThresholdFunctions.Silhouette;
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ using Polygons = System.Collections.Generic.List<System.Collections.Generic.List
|
|||
namespace MatterHackers.MatterControl.DesignTools
|
||||
{
|
||||
[HideMeterialAndColor]
|
||||
public class ImageToPathObject3D_2 : PathObject3D, IImageProvider, IObject3DControlsProvider, IPropertyGridModifier, IEditorWidgetModifier
|
||||
public class ImageToPathObject3D_2 : PathContainerObject3D, IImageProvider, IObject3DControlsProvider, IPropertyGridModifier, IEditorWidgetModifier
|
||||
{
|
||||
public ImageToPathObject3D_2()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ using System.Collections.Generic;
|
|||
|
||||
namespace MatterHackers.MatterControl.DesignTools
|
||||
{
|
||||
public abstract class PathObject3D : Object3D, IEditorDraw, IPrimaryOperationsSpecifier, IPathObject3D
|
||||
public abstract class PathContainerObject3D : Object3D, IEditorDraw, IPrimaryOperationsSpecifier, IPathObject3D
|
||||
{
|
||||
public void DrawEditor(Object3DControlsLayer layer, DrawEventArgs e)
|
||||
{
|
||||
|
|
@ -81,4 +81,13 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
return GetOperations(this.GetType());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is a class that is specifically holding a path and the mesh is a visualization of the path
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -50,7 +50,7 @@ namespace MatterHackers.MatterControl.DesignTools.Operations
|
|||
Sharp,
|
||||
}
|
||||
|
||||
public class InflatePathObject3D : PathObject3D, IEditorDraw, IObject3DControlsProvider
|
||||
public class InflatePathObject3D : PathContainerObject3D, IEditorDraw, IObject3DControlsProvider
|
||||
{
|
||||
public InflatePathObject3D()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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)]
|
||||
|
|
|
|||
|
|
@ -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<SceneOperation> GetOperations()
|
||||
{
|
||||
return PathObject3D.GetOperations(this.GetType());
|
||||
return PathContainerObject3D.GetOperations(this.GetType());
|
||||
}
|
||||
|
||||
public IVertexSource GetVertexSource()
|
||||
{
|
||||
return VertexStorage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ using Polygons = System.Collections.Generic.List<System.Collections.Generic.List
|
|||
|
||||
namespace MatterHackers.MatterControl.DesignTools.Operations
|
||||
{
|
||||
public class SmoothPathObject3D : PathObject3D, IEditorDraw, IObject3DControlsProvider
|
||||
public class SmoothPathObject3D : PathContainerObject3D, IEditorDraw, IObject3DControlsProvider
|
||||
{
|
||||
public SmoothPathObject3D()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
Outline
|
||||
}
|
||||
|
||||
public class BaseObject3D : PathObject3D, IPropertyGridModifier, IEditorDraw
|
||||
public class BaseObject3D : PathContainerObject3D, IPropertyGridModifier, IEditorDraw
|
||||
{
|
||||
public enum CenteringTypes
|
||||
{
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ using MatterHackers.VectorMath;
|
|||
|
||||
namespace MatterHackers.MatterControl.DesignTools.Primitives
|
||||
{
|
||||
public class BoxPathObject3D : PathObject3D, IObject3DControlsProvider, IEditorDraw, IPropertyGridModifier, IStaticThumbnail
|
||||
public class BoxPathObject3D : PathContainerObject3D, IObject3DControlsProvider, IEditorDraw, IPropertyGridModifier, IStaticThumbnail
|
||||
{
|
||||
public BoxPathObject3D()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
}
|
||||
|
||||
[HideChildrenFromTreeView]
|
||||
public class TextObject3D : PathObject3D, IPropertyGridModifier, IEditorDraw, IPrimaryOperationsSpecifier
|
||||
public class TextObject3D : PathContainerObject3D, IPropertyGridModifier, IEditorDraw, IPrimaryOperationsSpecifier
|
||||
{
|
||||
private bool refreshToolBar;
|
||||
|
||||
|
|
@ -284,7 +284,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
};
|
||||
if (Output == OutputDimensions.Output2D)
|
||||
{
|
||||
var pathObject = this as PathObject3D;
|
||||
var pathObject = this as PathContainerObject3D;
|
||||
pathObject.VertexStorage = new VertexStorage(
|
||||
new VertexSourceApplyTransform(
|
||||
new VertexStorage(scaledLetterPrinter), Affine.NewTranslation(offset.X, offset.Y)));
|
||||
|
|
@ -383,7 +383,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
{
|
||||
if (Output == OutputDimensions.Output2D)
|
||||
{
|
||||
return PathObject3D.GetOperations(this.GetType());
|
||||
return PathContainerObject3D.GetOperations(this.GetType());
|
||||
}
|
||||
|
||||
// return no enumerations
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.View3D
|
|||
|
||||
public IEnumerable<SceneOperation> GetOperations()
|
||||
{
|
||||
return PathObject3D.GetOperations(this.GetType());
|
||||
return PathContainerObject3D.GetOperations(this.GetType());
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue