mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-14 13:45:07 -05:00
NestTab starts a NestUndoRecorder once the trailing empty plate is in place, so opening is not an edit. Modified now follows the history's save point and unscoped edits (undoing back to the saved state clears it), and SaveAs records an unscoped edit before marking the save point. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
34 lines
1.1 KiB
C#
34 lines
1.1 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;
|
|
}
|
|
}
|