feat: add pierce point visualization and rename shape dimensions to Length/Width
Add toggleable pierce point drawing to PlateView that shows small red filled circles at each rapid move endpoint (where cutting begins). Wire through View menu, EditNestForm toggle, and MainForm handler. Also rename RectangleShape/RoundedRectangleShape Width/Height to Length/Width for consistency with CNC conventions, update MCP tools and tests accordingly. Fix SplitDrawingForm designer layout ordering and EntityView bend line selection styling. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,17 +5,17 @@ namespace OpenNest.Shapes
|
|||||||
{
|
{
|
||||||
public class RectangleShape : ShapeDefinition
|
public class RectangleShape : ShapeDefinition
|
||||||
{
|
{
|
||||||
|
public double Length { get; set; }
|
||||||
public double Width { get; set; }
|
public double Width { get; set; }
|
||||||
public double Height { get; set; }
|
|
||||||
|
|
||||||
public override Drawing GetDrawing()
|
public override Drawing GetDrawing()
|
||||||
{
|
{
|
||||||
var entities = new List<Entity>
|
var entities = new List<Entity>
|
||||||
{
|
{
|
||||||
new Line(0, 0, Width, 0),
|
new Line(0, 0, Length, 0),
|
||||||
new Line(Width, 0, Width, Height),
|
new Line(Length, 0, Length, Width),
|
||||||
new Line(Width, Height, 0, Height),
|
new Line(Length, Width, 0, Width),
|
||||||
new Line(0, Height, 0, 0)
|
new Line(0, Width, 0, 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
return CreateDrawing(entities);
|
return CreateDrawing(entities);
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ namespace OpenNest.Shapes
|
|||||||
{
|
{
|
||||||
public class RoundedRectangleShape : ShapeDefinition
|
public class RoundedRectangleShape : ShapeDefinition
|
||||||
{
|
{
|
||||||
|
public double Length { get; set; }
|
||||||
public double Width { get; set; }
|
public double Width { get; set; }
|
||||||
public double Height { get; set; }
|
|
||||||
public double Radius { get; set; }
|
public double Radius { get; set; }
|
||||||
|
|
||||||
public override Drawing GetDrawing()
|
public override Drawing GetDrawing()
|
||||||
@@ -17,36 +17,36 @@ namespace OpenNest.Shapes
|
|||||||
|
|
||||||
if (r <= 0)
|
if (r <= 0)
|
||||||
{
|
{
|
||||||
entities.Add(new Line(0, 0, Width, 0));
|
entities.Add(new Line(0, 0, Length, 0));
|
||||||
entities.Add(new Line(Width, 0, Width, Height));
|
entities.Add(new Line(Length, 0, Length, Width));
|
||||||
entities.Add(new Line(Width, Height, 0, Height));
|
entities.Add(new Line(Length, Width, 0, Width));
|
||||||
entities.Add(new Line(0, Height, 0, 0));
|
entities.Add(new Line(0, Width, 0, 0));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Bottom edge (left to right, above bottom-left arc to bottom-right arc)
|
// Bottom edge (left to right, above bottom-left arc to bottom-right arc)
|
||||||
entities.Add(new Line(r, 0, Width - r, 0));
|
entities.Add(new Line(r, 0, Length - r, 0));
|
||||||
|
|
||||||
// Bottom-right corner arc: center at (Width-r, r), from 270deg to 360deg
|
// Bottom-right corner arc: center at (Length-r, r), from 270deg to 360deg
|
||||||
entities.Add(new Arc(Width - r, r, r,
|
entities.Add(new Arc(Length - r, r, r,
|
||||||
Angle.ToRadians(270), Angle.ToRadians(360)));
|
Angle.ToRadians(270), Angle.ToRadians(360)));
|
||||||
|
|
||||||
// Right edge
|
// Right edge
|
||||||
entities.Add(new Line(Width, r, Width, Height - r));
|
entities.Add(new Line(Length, r, Length, Width - r));
|
||||||
|
|
||||||
// Top-right corner arc: center at (Width-r, Height-r), from 0deg to 90deg
|
// Top-right corner arc: center at (Length-r, Width-r), from 0deg to 90deg
|
||||||
entities.Add(new Arc(Width - r, Height - r, r,
|
entities.Add(new Arc(Length - r, Width - r, r,
|
||||||
Angle.ToRadians(0), Angle.ToRadians(90)));
|
Angle.ToRadians(0), Angle.ToRadians(90)));
|
||||||
|
|
||||||
// Top edge (right to left)
|
// Top edge (right to left)
|
||||||
entities.Add(new Line(Width - r, Height, r, Height));
|
entities.Add(new Line(Length - r, Width, r, Width));
|
||||||
|
|
||||||
// Top-left corner arc: center at (r, Height-r), from 90deg to 180deg
|
// Top-left corner arc: center at (r, Width-r), from 90deg to 180deg
|
||||||
entities.Add(new Arc(r, Height - r, r,
|
entities.Add(new Arc(r, Width - r, r,
|
||||||
Angle.ToRadians(90), Angle.ToRadians(180)));
|
Angle.ToRadians(90), Angle.ToRadians(180)));
|
||||||
|
|
||||||
// Left edge
|
// Left edge
|
||||||
entities.Add(new Line(0, Height - r, 0, r));
|
entities.Add(new Line(0, Width - r, 0, r));
|
||||||
|
|
||||||
// Bottom-left corner arc: center at (r, r), from 180deg to 270deg
|
// Bottom-left corner arc: center at (r, r), from 180deg to 270deg
|
||||||
entities.Add(new Arc(r, r, r,
|
entities.Add(new Arc(r, r, r,
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ namespace OpenNest.Mcp.Tools
|
|||||||
[Description("Name for the drawing")] string name,
|
[Description("Name for the drawing")] string name,
|
||||||
[Description("Shape type: rectangle, circle, l_shape, t_shape, gcode")] string shape,
|
[Description("Shape type: rectangle, circle, l_shape, t_shape, gcode")] string shape,
|
||||||
[Description("Width of the shape (not used for circle or gcode)")] double width = 10,
|
[Description("Width of the shape (not used for circle or gcode)")] double width = 10,
|
||||||
[Description("Height of the shape (not used for circle or gcode)")] double height = 10,
|
[Description("Length of the shape (not used for circle or gcode)")] double length = 10,
|
||||||
[Description("Radius for circle shape")] double radius = 5,
|
[Description("Radius for circle shape")] double radius = 5,
|
||||||
[Description("G-code string (only used when shape is 'gcode')")] string gcode = null)
|
[Description("G-code string (only used when shape is 'gcode')")] string gcode = null)
|
||||||
{
|
{
|
||||||
@@ -131,7 +131,7 @@ namespace OpenNest.Mcp.Tools
|
|||||||
switch (shape.ToLower())
|
switch (shape.ToLower())
|
||||||
{
|
{
|
||||||
case "rectangle":
|
case "rectangle":
|
||||||
shapeDef = new RectangleShape { Name = name, Width = width, Height = height };
|
shapeDef = new RectangleShape { Name = name, Width = width, Length = length };
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "circle":
|
case "circle":
|
||||||
@@ -139,11 +139,11 @@ namespace OpenNest.Mcp.Tools
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "l_shape":
|
case "l_shape":
|
||||||
shapeDef = new LShape { Name = name, Width = width, Height = height };
|
shapeDef = new LShape { Name = name, Width = width, Height = length };
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "t_shape":
|
case "t_shape":
|
||||||
shapeDef = new TShape { Name = name, Width = width, Height = height };
|
shapeDef = new TShape { Name = name, Width = width, Height = length };
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "gcode":
|
case "gcode":
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ namespace OpenNest.Mcp.Tools
|
|||||||
[Description("X origin of the area")] double x,
|
[Description("X origin of the area")] double x,
|
||||||
[Description("Y origin of the area")] double y,
|
[Description("Y origin of the area")] double y,
|
||||||
[Description("Width of the area")] double width,
|
[Description("Width of the area")] double width,
|
||||||
[Description("Height of the area")] double height,
|
[Description("Length of the area")] double length,
|
||||||
[Description("Maximum quantity to place (0 = unlimited)")] int quantity = 0)
|
[Description("Maximum quantity to place (0 = unlimited)")] int quantity = 0)
|
||||||
{
|
{
|
||||||
var plate = _session.GetPlate(plateIndex);
|
var plate = _session.GetPlate(plateIndex);
|
||||||
@@ -73,14 +73,14 @@ namespace OpenNest.Mcp.Tools
|
|||||||
var countBefore = plate.Parts.Count;
|
var countBefore = plate.Parts.Count;
|
||||||
var engine = NestEngineRegistry.Create(plate);
|
var engine = NestEngineRegistry.Create(plate);
|
||||||
var item = new NestItem { Drawing = drawing, Quantity = quantity };
|
var item = new NestItem { Drawing = drawing, Quantity = quantity };
|
||||||
var area = new Box(x, y, width, height);
|
var area = new Box(x, y, width, length);
|
||||||
var success = engine.Fill(item, area);
|
var success = engine.Fill(item, area);
|
||||||
|
|
||||||
var countAfter = plate.Parts.Count;
|
var countAfter = plate.Parts.Count;
|
||||||
var added = countAfter - countBefore;
|
var added = countAfter - countBefore;
|
||||||
|
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.AppendLine($"Fill area ({x:F1},{y:F1} {width:F1}x{height:F1}) on plate {plateIndex} with '{drawingName}': {(success ? "success" : "failed")}");
|
sb.AppendLine($"Fill area ({x:F1},{y:F1} {width:F1}x{length:F1}) on plate {plateIndex} with '{drawingName}': {(success ? "success" : "failed")}");
|
||||||
sb.AppendLine($" Parts added: {added}");
|
sb.AppendLine($" Parts added: {added}");
|
||||||
sb.AppendLine($" Total parts: {countAfter}");
|
sb.AppendLine($" Total parts: {countAfter}");
|
||||||
sb.AppendLine($" Utilization: {plate.Utilization():P1}");
|
sb.AppendLine($" Utilization: {plate.Utilization():P1}");
|
||||||
|
|||||||
@@ -19,13 +19,13 @@ namespace OpenNest.Mcp.Tools
|
|||||||
[Description("Create a new plate with the given dimensions and spacing. Returns plate index and work area.")]
|
[Description("Create a new plate with the given dimensions and spacing. Returns plate index and work area.")]
|
||||||
public string CreatePlate(
|
public string CreatePlate(
|
||||||
[Description("Plate width")] double width,
|
[Description("Plate width")] double width,
|
||||||
[Description("Plate height")] double height,
|
[Description("Plate length")] double length,
|
||||||
[Description("Spacing between parts (default 0)")] double partSpacing = 0,
|
[Description("Spacing between parts (default 0)")] double partSpacing = 0,
|
||||||
[Description("Edge spacing on all sides (default 0)")] double edgeSpacing = 0,
|
[Description("Edge spacing on all sides (default 0)")] double edgeSpacing = 0,
|
||||||
[Description("Quadrant 1-4 (default 1). 1=TopRight, 2=TopLeft, 3=BottomLeft, 4=BottomRight")] int quadrant = 1,
|
[Description("Quadrant 1-4 (default 1). 1=TopRight, 2=TopLeft, 3=BottomLeft, 4=BottomRight")] int quadrant = 1,
|
||||||
[Description("Material name (optional)")] string material = null)
|
[Description("Material name (optional)")] string material = null)
|
||||||
{
|
{
|
||||||
var plate = new Plate(width, height);
|
var plate = new Plate(width, length);
|
||||||
plate.PartSpacing = partSpacing;
|
plate.PartSpacing = partSpacing;
|
||||||
plate.EdgeSpacing = new Spacing(edgeSpacing, edgeSpacing);
|
plate.EdgeSpacing = new Spacing(edgeSpacing, edgeSpacing);
|
||||||
plate.Quadrant = quadrant;
|
plate.Quadrant = quadrant;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ public class RectangleShapeTests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void GetDrawing_ReturnsDrawingWithCorrectBoundingBox()
|
public void GetDrawing_ReturnsDrawingWithCorrectBoundingBox()
|
||||||
{
|
{
|
||||||
var shape = new RectangleShape { Width = 10, Height = 5 };
|
var shape = new RectangleShape { Length = 10, Width = 5 };
|
||||||
var drawing = shape.GetDrawing();
|
var drawing = shape.GetDrawing();
|
||||||
|
|
||||||
var bbox = drawing.Program.BoundingBox();
|
var bbox = drawing.Program.BoundingBox();
|
||||||
@@ -18,7 +18,7 @@ public class RectangleShapeTests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void GetDrawing_DefaultName_IsRectangle()
|
public void GetDrawing_DefaultName_IsRectangle()
|
||||||
{
|
{
|
||||||
var shape = new RectangleShape { Width = 10, Height = 5 };
|
var shape = new RectangleShape { Length = 10, Width = 5 };
|
||||||
var drawing = shape.GetDrawing();
|
var drawing = shape.GetDrawing();
|
||||||
|
|
||||||
Assert.Equal("Rectangle", drawing.Name);
|
Assert.Equal("Rectangle", drawing.Name);
|
||||||
@@ -27,7 +27,7 @@ public class RectangleShapeTests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void GetDrawing_CustomName_IsUsed()
|
public void GetDrawing_CustomName_IsUsed()
|
||||||
{
|
{
|
||||||
var shape = new RectangleShape { Name = "Plate1", Width = 10, Height = 5 };
|
var shape = new RectangleShape { Name = "Plate1", Length = 10, Width = 5 };
|
||||||
var drawing = shape.GetDrawing();
|
var drawing = shape.GetDrawing();
|
||||||
|
|
||||||
Assert.Equal("Plate1", drawing.Name);
|
Assert.Equal("Plate1", drawing.Name);
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ public class RoundedRectangleShapeTests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void GetDrawing_BoundingBoxMatchesDimensions()
|
public void GetDrawing_BoundingBoxMatchesDimensions()
|
||||||
{
|
{
|
||||||
var shape = new RoundedRectangleShape { Width = 20, Height = 10, Radius = 2 };
|
var shape = new RoundedRectangleShape { Length = 20, Width = 10, Radius = 2 };
|
||||||
var drawing = shape.GetDrawing();
|
var drawing = shape.GetDrawing();
|
||||||
|
|
||||||
var bbox = drawing.Program.BoundingBox();
|
var bbox = drawing.Program.BoundingBox();
|
||||||
@@ -18,7 +18,7 @@ public class RoundedRectangleShapeTests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void GetDrawing_AreaIsLessThanFullRectangle()
|
public void GetDrawing_AreaIsLessThanFullRectangle()
|
||||||
{
|
{
|
||||||
var shape = new RoundedRectangleShape { Width = 20, Height = 10, Radius = 2 };
|
var shape = new RoundedRectangleShape { Length = 20, Width = 10, Radius = 2 };
|
||||||
var drawing = shape.GetDrawing();
|
var drawing = shape.GetDrawing();
|
||||||
|
|
||||||
// Area should be less than 20*10=200 because corners are rounded
|
// Area should be less than 20*10=200 because corners are rounded
|
||||||
@@ -30,7 +30,7 @@ public class RoundedRectangleShapeTests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void GetDrawing_ZeroRadius_MatchesRectangleArea()
|
public void GetDrawing_ZeroRadius_MatchesRectangleArea()
|
||||||
{
|
{
|
||||||
var shape = new RoundedRectangleShape { Width = 20, Height = 10, Radius = 0 };
|
var shape = new RoundedRectangleShape { Length = 20, Width = 10, Radius = 0 };
|
||||||
var drawing = shape.GetDrawing();
|
var drawing = shape.GetDrawing();
|
||||||
|
|
||||||
Assert.Equal(200, drawing.Area, 0.5);
|
Assert.Equal(200, drawing.Area, 0.5);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using OpenNest.Converters;
|
using OpenNest.Converters;
|
||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
|
using OpenNest.Shapes;
|
||||||
|
|
||||||
namespace OpenNest.Tests.Splitting;
|
namespace OpenNest.Tests.Splitting;
|
||||||
|
|
||||||
@@ -8,16 +9,7 @@ public class SplitIntegrationTest
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void Split_SpikeGroove_NoContinuityGaps()
|
public void Split_SpikeGroove_NoContinuityGaps()
|
||||||
{
|
{
|
||||||
// Create a rectangle
|
var drawing = new RectangleShape { Name = "TEST", Length = 100, Width = 50 }.GetDrawing();
|
||||||
var entities = new List<Entity>
|
|
||||||
{
|
|
||||||
new Line(new Vector(0, 0), new Vector(100, 0)),
|
|
||||||
new Line(new Vector(100, 0), new Vector(100, 50)),
|
|
||||||
new Line(new Vector(100, 50), new Vector(0, 50)),
|
|
||||||
new Line(new Vector(0, 50), new Vector(0, 0))
|
|
||||||
};
|
|
||||||
var pgm = ConvertGeometry.ToProgram(entities);
|
|
||||||
var drawing = new Drawing("TEST", pgm);
|
|
||||||
|
|
||||||
var sl = new SplitLine(50.0, CutOffAxis.Vertical);
|
var sl = new SplitLine(50.0, CutOffAxis.Vertical);
|
||||||
sl.FeaturePositions.Add(12.5);
|
sl.FeaturePositions.Add(12.5);
|
||||||
@@ -60,15 +52,7 @@ public class SplitIntegrationTest
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void Split_SpikeGroove_Horizontal_NoContinuityGaps()
|
public void Split_SpikeGroove_Horizontal_NoContinuityGaps()
|
||||||
{
|
{
|
||||||
var entities = new List<Entity>
|
var drawing = new RectangleShape { Name = "TEST", Length = 100, Width = 50 }.GetDrawing();
|
||||||
{
|
|
||||||
new Line(new Vector(0, 0), new Vector(100, 0)),
|
|
||||||
new Line(new Vector(100, 0), new Vector(100, 50)),
|
|
||||||
new Line(new Vector(100, 50), new Vector(0, 50)),
|
|
||||||
new Line(new Vector(0, 50), new Vector(0, 0))
|
|
||||||
};
|
|
||||||
var pgm = ConvertGeometry.ToProgram(entities);
|
|
||||||
var drawing = new Drawing("TEST", pgm);
|
|
||||||
|
|
||||||
var sl = new SplitLine(25.0, CutOffAxis.Horizontal);
|
var sl = new SplitLine(25.0, CutOffAxis.Horizontal);
|
||||||
sl.FeaturePositions.Add(25.0);
|
sl.FeaturePositions.Add(25.0);
|
||||||
|
|||||||
@@ -194,9 +194,9 @@ namespace OpenNest.Controls
|
|||||||
{
|
{
|
||||||
DashPattern = new float[] { 8, 6 }
|
DashPattern = new float[] { 8, 6 }
|
||||||
};
|
};
|
||||||
using var selectedPen = new Pen(Color.Cyan, 2.5f)
|
using var glowPen = new Pen(Color.OrangeRed, 2.0f)
|
||||||
{
|
{
|
||||||
DashPattern = new float[] { 8, 6 }
|
DashPattern = new float[] { 6, 4 }
|
||||||
};
|
};
|
||||||
|
|
||||||
for (var i = 0; i < Bends.Count; i++)
|
for (var i = 0; i < Bends.Count; i++)
|
||||||
@@ -204,7 +204,15 @@ namespace OpenNest.Controls
|
|||||||
var bend = Bends[i];
|
var bend = Bends[i];
|
||||||
var pt1 = PointWorldToGraph(bend.StartPoint);
|
var pt1 = PointWorldToGraph(bend.StartPoint);
|
||||||
var pt2 = PointWorldToGraph(bend.EndPoint);
|
var pt2 = PointWorldToGraph(bend.EndPoint);
|
||||||
g.DrawLine(i == SelectedBendIndex ? selectedPen : bendPen, pt1, pt2);
|
|
||||||
|
if (i == SelectedBendIndex)
|
||||||
|
{
|
||||||
|
g.DrawLine(glowPen, pt1, pt2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g.DrawLine(bendPen, pt1, pt2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -131,6 +131,8 @@ namespace OpenNest.Controls
|
|||||||
|
|
||||||
public bool DrawRapid { get; set; }
|
public bool DrawRapid { get; set; }
|
||||||
|
|
||||||
|
public bool DrawPiercePoints { get; set; }
|
||||||
|
|
||||||
public bool DrawBounds { get; set; }
|
public bool DrawBounds { get; set; }
|
||||||
|
|
||||||
public bool DrawOffset { get; set; }
|
public bool DrawOffset { get; set; }
|
||||||
@@ -617,6 +619,9 @@ namespace OpenNest.Controls
|
|||||||
|
|
||||||
if (DrawRapid)
|
if (DrawRapid)
|
||||||
DrawRapids(g);
|
DrawRapids(g);
|
||||||
|
|
||||||
|
if (DrawPiercePoints)
|
||||||
|
DrawAllPiercePoints(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawBendLines(Graphics g, Part part)
|
private void DrawBendLines(Graphics g, Part part)
|
||||||
@@ -813,6 +818,54 @@ namespace OpenNest.Controls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DrawAllPiercePoints(Graphics g)
|
||||||
|
{
|
||||||
|
using var brush = new SolidBrush(Color.Red);
|
||||||
|
using var pen = new Pen(Color.DarkRed, 1f);
|
||||||
|
|
||||||
|
for (var i = 0; i < Plate.Parts.Count; ++i)
|
||||||
|
{
|
||||||
|
var part = Plate.Parts[i];
|
||||||
|
var pgm = part.Program;
|
||||||
|
var pos = part.Location;
|
||||||
|
DrawProgramPiercePoints(g, pgm, ref pos, brush, pen);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawProgramPiercePoints(Graphics g, Program pgm, ref Vector pos, Brush brush, Pen pen)
|
||||||
|
{
|
||||||
|
for (var i = 0; i < pgm.Length; ++i)
|
||||||
|
{
|
||||||
|
var code = pgm[i];
|
||||||
|
|
||||||
|
if (code.Type == CodeType.SubProgramCall)
|
||||||
|
{
|
||||||
|
var subpgm = (SubProgramCall)code;
|
||||||
|
if (subpgm.Program != null)
|
||||||
|
DrawProgramPiercePoints(g, subpgm.Program, ref pos, brush, pen);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var motion = code as Motion;
|
||||||
|
if (motion == null) continue;
|
||||||
|
|
||||||
|
var endpt = pgm.Mode == Mode.Incremental
|
||||||
|
? motion.EndPoint + pos
|
||||||
|
: motion.EndPoint;
|
||||||
|
|
||||||
|
if (code.Type == CodeType.RapidMove)
|
||||||
|
{
|
||||||
|
var pt = PointWorldToGraph(endpt);
|
||||||
|
var radius = 2f;
|
||||||
|
g.FillEllipse(brush, pt.X - radius, pt.Y - radius, radius * 2, radius * 2);
|
||||||
|
g.DrawEllipse(pen, pt.X - radius, pt.Y - radius, radius * 2, radius * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
pos = endpt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void DrawLine(Graphics g, Vector pt1, Vector pt2, Pen pen)
|
private void DrawLine(Graphics g, Vector pt1, Vector pt2, Pen pen)
|
||||||
{
|
{
|
||||||
var point1 = PointWorldToGraph(pt1);
|
var point1 = PointWorldToGraph(pt1);
|
||||||
|
|||||||
@@ -473,6 +473,12 @@ namespace OpenNest.Forms
|
|||||||
PlateView.Invalidate();
|
PlateView.Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void TogglePiercePoints()
|
||||||
|
{
|
||||||
|
PlateView.DrawPiercePoints = !PlateView.DrawPiercePoints;
|
||||||
|
PlateView.Invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
public void ToggleDrawBounds()
|
public void ToggleDrawBounds()
|
||||||
{
|
{
|
||||||
PlateView.DrawBounds = !PlateView.DrawBounds;
|
PlateView.DrawBounds = !PlateView.DrawBounds;
|
||||||
|
|||||||
14
OpenNest/Forms/MainForm.Designer.cs
generated
14
OpenNest/Forms/MainForm.Designer.cs
generated
@@ -48,6 +48,7 @@
|
|||||||
mnuEditSelectAll = new System.Windows.Forms.ToolStripMenuItem();
|
mnuEditSelectAll = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
mnuView = new System.Windows.Forms.ToolStripMenuItem();
|
mnuView = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
mnuViewDrawRapids = new System.Windows.Forms.ToolStripMenuItem();
|
mnuViewDrawRapids = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
mnuViewDrawPiercePoints = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
mnuViewDrawBounds = new System.Windows.Forms.ToolStripMenuItem();
|
mnuViewDrawBounds = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
mnuViewDrawOffset = new System.Windows.Forms.ToolStripMenuItem();
|
mnuViewDrawOffset = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
toolStripMenuItem5 = new System.Windows.Forms.ToolStripSeparator();
|
toolStripMenuItem5 = new System.Windows.Forms.ToolStripSeparator();
|
||||||
@@ -297,7 +298,7 @@
|
|||||||
//
|
//
|
||||||
// mnuView
|
// mnuView
|
||||||
//
|
//
|
||||||
mnuView.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { mnuViewDrawRapids, mnuViewDrawBounds, mnuViewDrawOffset, toolStripMenuItem5, mnuViewZoomTo, mnuViewZoomIn, mnuViewZoomOut });
|
mnuView.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { mnuViewDrawRapids, mnuViewDrawPiercePoints, mnuViewDrawBounds, mnuViewDrawOffset, toolStripMenuItem5, mnuViewZoomTo, mnuViewZoomIn, mnuViewZoomOut });
|
||||||
mnuView.Name = "mnuView";
|
mnuView.Name = "mnuView";
|
||||||
mnuView.Size = new System.Drawing.Size(44, 20);
|
mnuView.Size = new System.Drawing.Size(44, 20);
|
||||||
mnuView.Text = "&View";
|
mnuView.Text = "&View";
|
||||||
@@ -308,7 +309,15 @@
|
|||||||
mnuViewDrawRapids.Size = new System.Drawing.Size(222, 22);
|
mnuViewDrawRapids.Size = new System.Drawing.Size(222, 22);
|
||||||
mnuViewDrawRapids.Text = "Draw Rapids";
|
mnuViewDrawRapids.Text = "Draw Rapids";
|
||||||
mnuViewDrawRapids.Click += ToggleDrawRapids_Click;
|
mnuViewDrawRapids.Click += ToggleDrawRapids_Click;
|
||||||
//
|
//
|
||||||
|
// mnuViewDrawPiercePoints
|
||||||
|
//
|
||||||
|
mnuViewDrawPiercePoints.CheckOnClick = true;
|
||||||
|
mnuViewDrawPiercePoints.Name = "mnuViewDrawPiercePoints";
|
||||||
|
mnuViewDrawPiercePoints.Size = new System.Drawing.Size(222, 22);
|
||||||
|
mnuViewDrawPiercePoints.Text = "Draw Pierce Points";
|
||||||
|
mnuViewDrawPiercePoints.Click += ToggleDrawPiercePoints_Click;
|
||||||
|
//
|
||||||
// mnuViewDrawBounds
|
// mnuViewDrawBounds
|
||||||
//
|
//
|
||||||
mnuViewDrawBounds.CheckOnClick = true;
|
mnuViewDrawBounds.CheckOnClick = true;
|
||||||
@@ -1131,6 +1140,7 @@
|
|||||||
private System.Windows.Forms.ToolStripMenuItem mnuEditSelectAll;
|
private System.Windows.Forms.ToolStripMenuItem mnuEditSelectAll;
|
||||||
private System.Windows.Forms.ToolStripMenuItem mnuView;
|
private System.Windows.Forms.ToolStripMenuItem mnuView;
|
||||||
private System.Windows.Forms.ToolStripMenuItem mnuViewDrawRapids;
|
private System.Windows.Forms.ToolStripMenuItem mnuViewDrawRapids;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem mnuViewDrawPiercePoints;
|
||||||
private System.Windows.Forms.ToolStripMenuItem mnuViewDrawBounds;
|
private System.Windows.Forms.ToolStripMenuItem mnuViewDrawBounds;
|
||||||
private System.Windows.Forms.ToolStripMenuItem mnuViewDrawOffset;
|
private System.Windows.Forms.ToolStripMenuItem mnuViewDrawOffset;
|
||||||
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem5;
|
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem5;
|
||||||
|
|||||||
@@ -391,6 +391,7 @@ namespace OpenNest.Forms
|
|||||||
activeForm.PlateView.PartAdded += PlateView_PartAdded;
|
activeForm.PlateView.PartAdded += PlateView_PartAdded;
|
||||||
activeForm.PlateView.PartRemoved += PlateView_PartRemoved;
|
activeForm.PlateView.PartRemoved += PlateView_PartRemoved;
|
||||||
mnuViewDrawRapids.Checked = activeForm.PlateView.DrawRapid;
|
mnuViewDrawRapids.Checked = activeForm.PlateView.DrawRapid;
|
||||||
|
mnuViewDrawPiercePoints.Checked = activeForm.PlateView.DrawPiercePoints;
|
||||||
mnuViewDrawBounds.Checked = activeForm.PlateView.DrawBounds;
|
mnuViewDrawBounds.Checked = activeForm.PlateView.DrawBounds;
|
||||||
statusLabel1.Text = activeForm.PlateView.Status;
|
statusLabel1.Text = activeForm.PlateView.Status;
|
||||||
}
|
}
|
||||||
@@ -553,6 +554,13 @@ namespace OpenNest.Forms
|
|||||||
mnuViewDrawRapids.Checked = activeForm.PlateView.DrawRapid;
|
mnuViewDrawRapids.Checked = activeForm.PlateView.DrawRapid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ToggleDrawPiercePoints_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (activeForm == null) return;
|
||||||
|
activeForm.TogglePiercePoints();
|
||||||
|
mnuViewDrawPiercePoints.Checked = activeForm.PlateView.DrawPiercePoints;
|
||||||
|
}
|
||||||
|
|
||||||
private void ToggleDrawBounds_Click(object sender, EventArgs e)
|
private void ToggleDrawBounds_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (activeForm == null) return;
|
if (activeForm == null) return;
|
||||||
|
|||||||
75
OpenNest/Forms/SplitDrawingForm.Designer.cs
generated
75
OpenNest/Forms/SplitDrawingForm.Designer.cs
generated
@@ -29,9 +29,6 @@ namespace OpenNest.Forms
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
pnlSettings = new System.Windows.Forms.Panel();
|
pnlSettings = new System.Windows.Forms.Panel();
|
||||||
pnlButtons = new System.Windows.Forms.Panel();
|
|
||||||
btnCancel = new System.Windows.Forms.Button();
|
|
||||||
btnOK = new System.Windows.Forms.Button();
|
|
||||||
grpSpikeParams = new System.Windows.Forms.GroupBox();
|
grpSpikeParams = new System.Windows.Forms.GroupBox();
|
||||||
nudSpikePairCount = new System.Windows.Forms.NumericUpDown();
|
nudSpikePairCount = new System.Windows.Forms.NumericUpDown();
|
||||||
lblSpikePairCount = new System.Windows.Forms.Label();
|
lblSpikePairCount = new System.Windows.Forms.Label();
|
||||||
@@ -70,6 +67,9 @@ namespace OpenNest.Forms
|
|||||||
radByCount = new System.Windows.Forms.RadioButton();
|
radByCount = new System.Windows.Forms.RadioButton();
|
||||||
radFitToPlate = new System.Windows.Forms.RadioButton();
|
radFitToPlate = new System.Windows.Forms.RadioButton();
|
||||||
radManual = new System.Windows.Forms.RadioButton();
|
radManual = new System.Windows.Forms.RadioButton();
|
||||||
|
pnlButtons = new System.Windows.Forms.Panel();
|
||||||
|
btnOK = new System.Windows.Forms.Button();
|
||||||
|
btnCancel = new System.Windows.Forms.Button();
|
||||||
pnlPreview = new SplitPreview();
|
pnlPreview = new SplitPreview();
|
||||||
toolStrip = new System.Windows.Forms.ToolStrip();
|
toolStrip = new System.Windows.Forms.ToolStrip();
|
||||||
btnAddLine = new System.Windows.Forms.ToolStripButton();
|
btnAddLine = new System.Windows.Forms.ToolStripButton();
|
||||||
@@ -96,6 +96,7 @@ namespace OpenNest.Forms
|
|||||||
((System.ComponentModel.ISupportInitialize)nudPlateHeight).BeginInit();
|
((System.ComponentModel.ISupportInitialize)nudPlateHeight).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)nudPlateWidth).BeginInit();
|
((System.ComponentModel.ISupportInitialize)nudPlateWidth).BeginInit();
|
||||||
grpMethod.SuspendLayout();
|
grpMethod.SuspendLayout();
|
||||||
|
pnlButtons.SuspendLayout();
|
||||||
toolStrip.SuspendLayout();
|
toolStrip.SuspendLayout();
|
||||||
statusStrip.SuspendLayout();
|
statusStrip.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
@@ -116,38 +117,6 @@ namespace OpenNest.Forms
|
|||||||
pnlSettings.Padding = new System.Windows.Forms.Padding(6);
|
pnlSettings.Padding = new System.Windows.Forms.Padding(6);
|
||||||
pnlSettings.Size = new System.Drawing.Size(220, 611);
|
pnlSettings.Size = new System.Drawing.Size(220, 611);
|
||||||
pnlSettings.TabIndex = 2;
|
pnlSettings.TabIndex = 2;
|
||||||
//
|
|
||||||
// pnlButtons
|
|
||||||
//
|
|
||||||
pnlButtons.Controls.Add(btnOK);
|
|
||||||
pnlButtons.Controls.Add(btnCancel);
|
|
||||||
pnlButtons.Dock = System.Windows.Forms.DockStyle.Bottom;
|
|
||||||
pnlButtons.Name = "pnlButtons";
|
|
||||||
pnlButtons.Size = new System.Drawing.Size(208, 40);
|
|
||||||
pnlButtons.TabIndex = 8;
|
|
||||||
//
|
|
||||||
// btnCancel
|
|
||||||
//
|
|
||||||
btnCancel.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
|
|
||||||
btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
|
||||||
btnCancel.Location = new System.Drawing.Point(110, 6);
|
|
||||||
btnCancel.Name = "btnCancel";
|
|
||||||
btnCancel.Size = new System.Drawing.Size(80, 28);
|
|
||||||
btnCancel.TabIndex = 7;
|
|
||||||
btnCancel.Text = "Cancel";
|
|
||||||
btnCancel.UseVisualStyleBackColor = true;
|
|
||||||
btnCancel.Click += OnCancel;
|
|
||||||
//
|
|
||||||
// btnOK
|
|
||||||
//
|
|
||||||
btnOK.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
|
|
||||||
btnOK.Location = new System.Drawing.Point(20, 6);
|
|
||||||
btnOK.Name = "btnOK";
|
|
||||||
btnOK.Size = new System.Drawing.Size(80, 28);
|
|
||||||
btnOK.TabIndex = 6;
|
|
||||||
btnOK.Text = "OK";
|
|
||||||
btnOK.UseVisualStyleBackColor = true;
|
|
||||||
btnOK.Click += OnOK;
|
|
||||||
//
|
//
|
||||||
// grpSpikeParams
|
// grpSpikeParams
|
||||||
//
|
//
|
||||||
@@ -216,7 +185,7 @@ namespace OpenNest.Forms
|
|||||||
nudGrooveDepth.Name = "nudGrooveDepth";
|
nudGrooveDepth.Name = "nudGrooveDepth";
|
||||||
nudGrooveDepth.Size = new System.Drawing.Size(88, 23);
|
nudGrooveDepth.Size = new System.Drawing.Size(88, 23);
|
||||||
nudGrooveDepth.TabIndex = 1;
|
nudGrooveDepth.TabIndex = 1;
|
||||||
nudGrooveDepth.Value = new decimal(new int[] { 625, 0, 0, 196608 });
|
nudGrooveDepth.Value = new decimal(new int[] { 125, 0, 0, 196608 });
|
||||||
nudGrooveDepth.ValueChanged += OnSpikeParamChanged;
|
nudGrooveDepth.ValueChanged += OnSpikeParamChanged;
|
||||||
//
|
//
|
||||||
// lblGrooveDepth
|
// lblGrooveDepth
|
||||||
@@ -568,6 +537,39 @@ namespace OpenNest.Forms
|
|||||||
radManual.Text = "Manual";
|
radManual.Text = "Manual";
|
||||||
radManual.CheckedChanged += OnMethodChanged;
|
radManual.CheckedChanged += OnMethodChanged;
|
||||||
//
|
//
|
||||||
|
// pnlButtons
|
||||||
|
//
|
||||||
|
pnlButtons.Controls.Add(btnOK);
|
||||||
|
pnlButtons.Controls.Add(btnCancel);
|
||||||
|
pnlButtons.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||||
|
pnlButtons.Location = new System.Drawing.Point(6, 637);
|
||||||
|
pnlButtons.Name = "pnlButtons";
|
||||||
|
pnlButtons.Size = new System.Drawing.Size(191, 40);
|
||||||
|
pnlButtons.TabIndex = 8;
|
||||||
|
//
|
||||||
|
// btnOK
|
||||||
|
//
|
||||||
|
btnOK.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
|
||||||
|
btnOK.Location = new System.Drawing.Point(11, 6);
|
||||||
|
btnOK.Name = "btnOK";
|
||||||
|
btnOK.Size = new System.Drawing.Size(80, 28);
|
||||||
|
btnOK.TabIndex = 6;
|
||||||
|
btnOK.Text = "OK";
|
||||||
|
btnOK.UseVisualStyleBackColor = true;
|
||||||
|
btnOK.Click += OnOK;
|
||||||
|
//
|
||||||
|
// btnCancel
|
||||||
|
//
|
||||||
|
btnCancel.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
|
||||||
|
btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||||
|
btnCancel.Location = new System.Drawing.Point(101, 6);
|
||||||
|
btnCancel.Name = "btnCancel";
|
||||||
|
btnCancel.Size = new System.Drawing.Size(80, 28);
|
||||||
|
btnCancel.TabIndex = 7;
|
||||||
|
btnCancel.Text = "Cancel";
|
||||||
|
btnCancel.UseVisualStyleBackColor = true;
|
||||||
|
btnCancel.Click += OnCancel;
|
||||||
|
//
|
||||||
// pnlPreview
|
// pnlPreview
|
||||||
//
|
//
|
||||||
pnlPreview.BackColor = System.Drawing.Color.FromArgb(33, 40, 48);
|
pnlPreview.BackColor = System.Drawing.Color.FromArgb(33, 40, 48);
|
||||||
@@ -667,6 +669,7 @@ namespace OpenNest.Forms
|
|||||||
((System.ComponentModel.ISupportInitialize)nudPlateWidth).EndInit();
|
((System.ComponentModel.ISupportInitialize)nudPlateWidth).EndInit();
|
||||||
grpMethod.ResumeLayout(false);
|
grpMethod.ResumeLayout(false);
|
||||||
grpMethod.PerformLayout();
|
grpMethod.PerformLayout();
|
||||||
|
pnlButtons.ResumeLayout(false);
|
||||||
toolStrip.ResumeLayout(false);
|
toolStrip.ResumeLayout(false);
|
||||||
toolStrip.PerformLayout();
|
toolStrip.PerformLayout();
|
||||||
statusStrip.ResumeLayout(false);
|
statusStrip.ResumeLayout(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user