working on calculating a base from a mesh (not path)
This commit is contained in:
parent
9ac84fce23
commit
97bd8a8b6d
4 changed files with 18 additions and 3 deletions
|
|
@ -71,7 +71,7 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
return new SceneOperation("AddBase")
|
||||
{
|
||||
OperationType = typeof(IPathObject),
|
||||
OperationType = typeof(IObject3D),
|
||||
TitleResolver = () => "Add Base".Localize(),
|
||||
ResultType = typeof(BaseObject3D),
|
||||
Action = (sceneContext) =>
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ using MatterHackers.DataConverters2D;
|
|||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.DesignTools.Operations;
|
||||
using MatterHackers.PolygonMesh.Csg;
|
||||
using MatterHackers.VectorMath;
|
||||
using Newtonsoft.Json;
|
||||
using Polygon = System.Collections.Generic.List<ClipperLib.IntPoint>;
|
||||
|
|
@ -125,6 +126,20 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
get
|
||||
{
|
||||
var vertexSource = (IPathObject)this.Descendants<IObject3D>().FirstOrDefault((i) => i is IPathObject);
|
||||
var meshSource = this.Descendants<IObject3D>().FirstOrDefault((i) => i.Mesh != null);
|
||||
var mesh = meshSource?.Mesh;
|
||||
if (vertexSource?.VertexSource == null
|
||||
&& mesh != null)
|
||||
{
|
||||
// return the vertex source of the bottom of the mesh
|
||||
var aabb = this.GetAxisAlignedBoundingBox();
|
||||
var cutPlane = new Plane(Vector3.UnitZ, new Vector3(0, 0, aabb.MinXYZ.Z + .1));
|
||||
cutPlane = Plane.Transform(cutPlane, this.Matrix.Inverted);
|
||||
var slice = SliceLayer.CreateSlice(mesh, cutPlane);
|
||||
return slice.CreateVertexStorage();
|
||||
|
||||
}
|
||||
|
||||
return vertexSource?.VertexSource;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 18f8d4db0a361138d68845ef24fd22f5804f9347
|
||||
Subproject commit 630ef7334038b950c0a9287409c31ab5a70e6f36
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit e56cb7d0578299174d9fb971e9e731dfb8c29e77
|
||||
Subproject commit 6c49a709565589f5e233f81bfc1c1ed60b08361d
|
||||
Loading…
Add table
Add a link
Reference in a new issue