Working on cut at plane
This commit is contained in:
parent
67b0fef82a
commit
3257ce4513
7 changed files with 1300 additions and 24 deletions
|
|
@ -28,13 +28,16 @@ either expressed or implied, of the FreeBSD Project.
|
|||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using ClipperLib;
|
||||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.DesignTools.Operations;
|
||||
using MatterHackers.PolygonMesh;
|
||||
using MatterHackers.PolygonMesh.Csg;
|
||||
using MatterHackers.VectorMath;
|
||||
using MatterHackers.DataConverters2D;
|
||||
using Polygon = System.Collections.Generic.List<ClipperLib.IntPoint>;
|
||||
using Polygons = System.Collections.Generic.List<System.Collections.Generic.List<ClipperLib.IntPoint>>;
|
||||
|
||||
|
|
@ -49,14 +52,13 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
|
||||
public double CutHeight { get; set; } = 10;
|
||||
|
||||
private double cutMargin = .1;
|
||||
private double cutMargin = .01;
|
||||
|
||||
public Mesh Cut(Mesh inMesh)
|
||||
{
|
||||
var mesh = new Mesh(inMesh.Vertices, inMesh.Faces);
|
||||
|
||||
// copy every face that is on or below the cut plane
|
||||
|
||||
// cut the faces at the cut plane
|
||||
mesh.Split(new Plane(Vector3.UnitZ, CutHeight), cutMargin, cleanAndMerge: false);
|
||||
|
||||
|
|
@ -64,7 +66,13 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
RemoveFacesAboveCut(mesh);
|
||||
|
||||
// calculate and add the PWN face from the loops
|
||||
// vertexSourceBottom.TriangulateFaces(bottomTeselatedSource, mesh);
|
||||
var cutPlane = new Plane(Vector3.UnitZ, new Vector3(0, 0, CutHeight));
|
||||
var slice = SliceLayer.CreateSlice(inMesh, cutPlane);
|
||||
|
||||
var aPolys = slice.Vertices().CreatePolygons();
|
||||
aPolys = aPolys.GetCorrectedWinding();
|
||||
|
||||
aPolys.CreateVertexStorage().Vertices().TriangulateFaces(null, mesh, CutHeight);
|
||||
|
||||
return mesh;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -212,6 +212,8 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
|
||||
private int _internalToothCount;
|
||||
|
||||
public double OuterEdgeWidth { get; set; }
|
||||
|
||||
public int InternalToothCount
|
||||
{
|
||||
get => _internalToothCount;
|
||||
|
|
@ -225,8 +227,6 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
|
||||
public bool Debug { get; set; } = false;
|
||||
|
||||
public double OuterEdgeWidth { get; set; }
|
||||
|
||||
private List<Polygons> debugData = new List<Polygons>();
|
||||
|
||||
public override IEnumerable<VertexData> Vertices()
|
||||
|
|
@ -461,15 +461,18 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
{
|
||||
this.CenterHoleDiameter = 0;
|
||||
|
||||
//var externalGear = CreateExternalGearShape();
|
||||
|
||||
var innerRadius = this.pitchRadius + (1 - this.profileShift) * this.addendum + this.Clearance;
|
||||
var outerRadius = innerRadius + OuterEdgeWidth;
|
||||
var outerCircle = Circle(this.center.X, center.Y, outerRadius, 1000);
|
||||
|
||||
//var internalGear = outerCircle.Subtract(externalGear);
|
||||
//debugData.Add(internalGear);
|
||||
// return internalGear;
|
||||
var simpleInnerGear = false;
|
||||
if (simpleInnerGear)
|
||||
{
|
||||
var externalGear = CreateExternalGearShape();
|
||||
var internalGear = outerCircle.Subtract(externalGear);
|
||||
debugData.Add(internalGear);
|
||||
return internalGear;
|
||||
}
|
||||
|
||||
var singleTooth = this.CreateInternalToothProfile();
|
||||
debugData.Add(singleTooth);
|
||||
|
|
|
|||
1263
MatterControlLib/DesignTools/Primitives/Gear2D_2.cs
Normal file
1263
MatterControlLib/DesignTools/Primitives/Gear2D_2.cs
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1090,7 +1090,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
private void DrawObject3DControlVolumes(DrawEventArgs e)
|
||||
{
|
||||
foreach (var item in this.Object3DControls)
|
||||
var currentControls = this.Object3DControls.ToArray();
|
||||
|
||||
foreach (var item in currentControls)
|
||||
{
|
||||
item.Visible = !SuppressObject3DControls;
|
||||
}
|
||||
|
|
@ -1103,7 +1105,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
// draw on top of anything that is already drawn
|
||||
GL.Disable(EnableCap.DepthTest);
|
||||
|
||||
foreach (var object3DControl in this.Object3DControls)
|
||||
foreach (var object3DControl in currentControls)
|
||||
{
|
||||
if (object3DControl.DrawOnTop)
|
||||
{
|
||||
|
|
@ -1115,7 +1117,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
GL.Enable(EnableCap.DepthTest);
|
||||
|
||||
// Draw again setting the depth buffer and ensuring that all the interaction objects are sorted as well as we can
|
||||
foreach (var object3DVolume in this.Object3DControls)
|
||||
foreach (var object3DVolume in currentControls)
|
||||
{
|
||||
object3DVolume.Draw(new DrawGlContentEventArgs(true, e));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,11 +46,12 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
public class HelpTreePanel : SearchableTreePanel
|
||||
{
|
||||
private string guideKey = null;
|
||||
private readonly string guideKey = null;
|
||||
|
||||
public HelpTreePanel(ThemeConfig theme, string guideKey = null)
|
||||
: base(theme)
|
||||
{
|
||||
this.guideKey = guideKey;
|
||||
horizontalSplitter.Panel1.BackgroundColor = Color.Black.WithAlpha(12);
|
||||
|
||||
var toolbar = new Toolbar(theme.TabbarPadding)
|
||||
|
|
@ -174,10 +175,10 @@ namespace MatterHackers.MatterControl
|
|||
AddContent(keys, "Keys".Localize(), true, true);
|
||||
AddContent(actions, "Action".Localize(), false, true);
|
||||
|
||||
foreach (var keyAction in keyActions)
|
||||
foreach (var (key, action) in keyActions)
|
||||
{
|
||||
AddContent(keys, keyAction.key, true, false);
|
||||
AddContent(actions, keyAction.action, false, false);
|
||||
AddContent(keys, key, true, false);
|
||||
AddContent(actions, action, false, false);
|
||||
}
|
||||
|
||||
// center the vertical bar in the view by adding margin to the small side
|
||||
|
|
@ -233,10 +234,10 @@ namespace MatterHackers.MatterControl
|
|||
AddContent(mouseKeys, "Mouse".Localize(), true, true);
|
||||
AddContent(mouseActions, "Action".Localize(), false, true);
|
||||
|
||||
foreach (var keyAction in mouseKeyActions)
|
||||
foreach (var (key, action) in mouseKeyActions)
|
||||
{
|
||||
AddContent(mouseKeys, keyAction.key, true, false);
|
||||
AddContent(mouseActions, keyAction.action, false, false);
|
||||
AddContent(mouseKeys, key, true, false);
|
||||
AddContent(mouseActions, action, false, false);
|
||||
}
|
||||
|
||||
// center the vertical bar in the view by adding margin to the small side
|
||||
|
|
@ -360,8 +361,7 @@ namespace MatterHackers.MatterControl
|
|||
private TreeNode initialSelection = null;
|
||||
private TreeNode rootNode;
|
||||
|
||||
private Dictionary<string, HelpArticleTreeNode> nodesByPath = new Dictionary<string, HelpArticleTreeNode>();
|
||||
private IEnumerable<HelpSearchResult> searchResults;
|
||||
private readonly Dictionary<string, HelpArticleTreeNode> nodesByPath = new Dictionary<string, HelpArticleTreeNode>();
|
||||
private HashSet<string> searchHits;
|
||||
|
||||
private TreeNode ProcessTree(HelpArticle container)
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 46b47e5e26d806fc4a23d098fa7cab637bf40e47
|
||||
Subproject commit 524c83a15f0e0926aa1eed676eb1a97946c62231
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit f4ce5c663a639111503d89fa1e4812ee6e944a1d
|
||||
Subproject commit a7e68b55a7d4aaabadf9a1b9e7abd06bade60ab0
|
||||
Loading…
Add table
Add a link
Reference in a new issue