Files
OpenNest/OpenNest.Desktop.Tests/TestNests.cs
T
ajandClaude Opus 5.5 6cb56a6afd feat(desktop): share the cut-time report and cut simulation playhead
CutTimeReport computes and words what Calculate Cut Time shows for a plate
or nest (time from the simulation with acceleration plus clamp removal,
distances and counts from the timing info) as the WinForms timing window.
CutTimeEntry and CutTimeMachineChoice hold the dialog's box ranges, the
entered values' cut parameters and the Acceleration list's entries.
CutSimulationPlayback is the simulator's playhead without drawing: play,
pause and speed, scrubbing, part, cutout and move stepping, retiming that
keeps the torch in place and which parts it has not reached;
CutSimulationStatus words its status rows.

The WinForms timing window, cut parameters dialog, machine box, simulator
and overlay now call them; their behavior is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 18:45:44 -05:00

62 lines
2.2 KiB
C#

using OpenNest.CNC;
using OpenNest.Geometry;
namespace OpenNest.Desktop.Tests;
internal static class TestNests
{
/// <summary>Records an edit of the tab's nest, as a desktop command does.</summary>
public static void Edit(NestTab tab) =>
tab.Undo.RecordChange("Edit", () => tab.Document.Nest.Notes += "edited");
/// <summary>A nest with one 48x96 plate holding one 10x10 square part.</summary>
public static Nest OneSquare()
{
var program = new Program();
program.Codes.Add(new RapidMove(new Vector(0, 0)));
program.Codes.Add(new LinearMove(new Vector(10, 0)));
program.Codes.Add(new LinearMove(new Vector(10, 10)));
program.Codes.Add(new LinearMove(new Vector(0, 10)));
program.Codes.Add(new LinearMove(new Vector(0, 0)));
var drawing = new Drawing("square", program);
drawing.Quantity.Required = 1;
var plate = new Plate(new Size(48, 96));
plate.Parts.Add(new Part(drawing));
var nest = new Nest { Name = "test" };
nest.Drawings.Add(drawing);
nest.Plates.Add(plate);
return nest;
}
/// <summary>
/// A nest with one 48x96 plate holding two 10x10 squares drawn as imported part programs are
/// (incremental, counterclockwise from the corner), the second 20 to the right of the first.
/// </summary>
public static Nest TwoSquares()
{
var program = new Program(Mode.Incremental);
program.Codes.Add(new RapidMove(new Vector(0, 0)));
program.Codes.Add(new LinearMove(new Vector(10, 0)));
program.Codes.Add(new LinearMove(new Vector(0, 10)));
program.Codes.Add(new LinearMove(new Vector(-10, 0)));
program.Codes.Add(new LinearMove(new Vector(0, -10)));
var drawing = new Drawing("square", program);
drawing.Quantity.Required = 2;
var plate = new Plate(new Size(48, 96));
plate.Parts.Add(new Part(drawing));
var second = new Part(drawing);
second.Offset(new Vector(20, 0));
plate.Parts.Add(second);
var nest = new Nest { Name = "test" };
nest.Drawings.Add(drawing);
nest.Plates.Add(plate);
return nest;
}
}