From b6a9cea93f3374738628d9de4f6fe213d54e0ef7 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Sun, 22 Nov 2026 23:55:30 -0500 Subject: [PATCH] feat(cutting): group Plan Cutting's settings and keep the plan on Cancel The Cutting Settings and Cut-off Settings buttons looked alike and were easy to mix up. Plan Cutting now shows two titled groups: Part cutting (Leads & Tabs..., its summary and Keep current part order) and Scrap cut-offs (the box, Strips... and the strip width). Planner messages name the renamed button. Canceling Leads & Tabs, or OK with nothing changed, keeps the current plan. Canceling Strips keeps it too when no cut-offs were staged; with the box ticked the staged cut-offs had to come off, so it still replans. Co-Authored-By: Claude Opus 5.5 --- .../CuttingPlanning/CuttingPlanBatch.cs | 2 +- .../CuttingPlanning/JointCuttingPlanSearch.cs | 2 +- .../CuttingPlanMessageTests.cs | 2 +- .../Forms/CuttingInspectionPanelTests.cs | 42 ++++++- OpenNest/Controls/LeadsEditor.cs | 2 +- OpenNest/Forms/CuttingInspectionPanel.cs | 104 +++++++++++++----- docs/cutting-planner.md | 14 ++- docs/geometry/pierce-zone.md | 2 +- 8 files changed, 132 insertions(+), 38 deletions(-) diff --git a/OpenNest.Engine/CuttingPlanning/CuttingPlanBatch.cs b/OpenNest.Engine/CuttingPlanning/CuttingPlanBatch.cs index b005cb23..4b1135fe 100644 --- a/OpenNest.Engine/CuttingPlanning/CuttingPlanBatch.cs +++ b/OpenNest.Engine/CuttingPlanning/CuttingPlanBatch.cs @@ -484,7 +484,7 @@ public sealed class CuttingPlanProposal /// Operator-facing summary: one overall line, then each plate and its findings. /// How this front end changes the settings, completed by /// "a lead-in type other than None..." in the missing lead-in advice. - public IReadOnlyList Describe(string unit, string changeSettings = "Open Cutting Settings... and select") + public IReadOnlyList Describe(string unit, string changeSettings = "Open Leads & Tabs... and select") { var lines = new List(); var blocked = Plates.Count(p => !p.CanApplyWithWarnings); diff --git a/OpenNest.Engine/CuttingPlanning/JointCuttingPlanSearch.cs b/OpenNest.Engine/CuttingPlanning/JointCuttingPlanSearch.cs index 4d513b36..9c5cc05e 100644 --- a/OpenNest.Engine/CuttingPlanning/JointCuttingPlanSearch.cs +++ b/OpenNest.Engine/CuttingPlanning/JointCuttingPlanSearch.cs @@ -1430,7 +1430,7 @@ internal static class JointCuttingPlanSearch && reportedNoFit.Add(source.SourceOrdinal * 1000 + contour)) rejected.Add(Finding(source, null, $"No tested lead-in fits on cutting contour {contour + 1}: {selection.Reason} " - + "Try reducing the lead-in length in Cutting Settings...; if nearby parts obstruct the lead-in, " + + "Try reducing the lead-in length in Leads & Tabs...; if nearby parts obstruct the lead-in, " + "space the parts farther apart." + PierceZoneHint() + (scrapReason == null ? "" : $" A pierce in open scrap was also tried: {scrapReason}") + (erodedReason == null ? "" : $" A pierce found by eroding the cutout was also tried: {erodedReason}") diff --git a/OpenNest.Tests/CuttingPlanning/CuttingPlanMessageTests.cs b/OpenNest.Tests/CuttingPlanning/CuttingPlanMessageTests.cs index 5a6da834..1d13ceb1 100644 --- a/OpenNest.Tests/CuttingPlanning/CuttingPlanMessageTests.cs +++ b/OpenNest.Tests/CuttingPlanning/CuttingPlanMessageTests.cs @@ -188,7 +188,7 @@ public class CuttingPlanMessageTests Assert.Contains(CuttingPlanProposal.SearchLimitHint, text); Assert.Contains("it may still find no plan", CuttingPlanProposal.SearchLimitHint); Assert.True(proposal.Plates[0].SearchLimitReached); - Assert.DoesNotContain("Open Cutting Settings...", text); + Assert.DoesNotContain("Open Leads & Tabs...", text); Assert.DoesNotContain("missing or zero-length lead-in", text); Assert.False(proposal.CanApply); } diff --git a/OpenNest.WinForms.Tests/Forms/CuttingInspectionPanelTests.cs b/OpenNest.WinForms.Tests/Forms/CuttingInspectionPanelTests.cs index 6c3d18c4..6ab144fd 100644 --- a/OpenNest.WinForms.Tests/Forms/CuttingInspectionPanelTests.cs +++ b/OpenNest.WinForms.Tests/Forms/CuttingInspectionPanelTests.cs @@ -975,6 +975,41 @@ public class CuttingInspectionPanelTests } }); + [Fact] + public void LeadsAndTabsReplansOnlyWhenTheSettingsChange() => RunSta(() => + { + using var editor = Editor(); + editor.Show(); + editor.PlateManager.LoadAt(0); + editor.OpenCuttingInspection(); + var panel = editor.CuttingInspection!; + PumpUntil(() => panel.Proposal != null && !panel.IsPlanning); + var planned = panel.Proposal; + var settings = Field