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(panel, "settingsButton");
+
+ panel.ShowCuttingSettings = dialog => DialogResult.Cancel;
+ settings.PerformClick();
+ Assert.False(panel.IsPlanning);
+ Assert.Same(planned, panel.Proposal);
+
+ panel.ShowCuttingSettings = dialog => DialogResult.OK; // Unchanged.
+ settings.PerformClick();
+ Assert.False(panel.IsPlanning);
+ Assert.Same(planned, panel.Proposal);
+
+ panel.ShowCuttingSettings = dialog =>
+ {
+ var changed = dialog.GetParameters();
+ changed.SupportTabs = !changed.SupportTabs;
+ dialog.LoadParameters(changed);
+ return DialogResult.OK;
+ };
+ settings.PerformClick();
+ PumpUntil(() => panel.Proposal != null && !panel.IsPlanning);
+ Assert.NotSame(planned, panel.Proposal);
+ panel.RequestClose();
+ });
+
[Fact]
public void CutOffSettingsOpensTheAutomaticCutOffDialogAndReplansWithItsChoice() => RunSta(() =>
{
@@ -991,10 +1026,13 @@ public class CuttingInspectionPanelTests
var panel = editor.CuttingInspection!;
PumpUntil(() => panel.Proposal != null && !panel.IsPlanning);
Assert.Equal(35, panel.CutOffOptions.Spacing);
+ var planned = panel.Proposal;
panel.ShowCutOffSettings = form => DialogResult.Cancel;
Field(panel, "cutOffSettingsButton").PerformClick();
- PumpUntil(() => panel.Proposal != null && !panel.IsPlanning);
+ Assert.False(panel.IsPlanning); // Nothing was staged, so Cancel keeps the plan.
+ Assert.Same(planned, panel.Proposal);
+ Assert.True(Field(panel, "applyButton").Enabled);
Assert.False(Field(panel, "autoCutOffsCheckBox").Checked);
Assert.Equal(35, panel.CutOffOptions.Spacing);
Assert.Empty(plate.CutOffs);
@@ -1018,7 +1056,7 @@ public class CuttingInspectionPanelTests
Assert.NotNull(shown);
Assert.Equal((30.0, 10.0), (panel.CutOffOptions.Spacing, panel.CutOffOptions.MinimumTailLength));
Assert.True(Field(panel, "autoCutOffsCheckBox").Checked);
- Assert.Contains("30 in strips", Field(panel, "autoCutOffsCheckBox").Text);
+ Assert.Contains("30 in strips", Field(panel, "cutOffLabel").Text);
Assert.NotNull(panel.StagedCutOffs);
Assert.NotEmpty(plate.CutOffs);
Assert.Equal(plate.CutOffs.Count, panel.Proposal.Plates[0].Result.ProposedOrder.Count(p => p.IsCutOff));
diff --git a/OpenNest/Controls/LeadsEditor.cs b/OpenNest/Controls/LeadsEditor.cs
index 279b745d..b352abcb 100644
--- a/OpenNest/Controls/LeadsEditor.cs
+++ b/OpenNest/Controls/LeadsEditor.cs
@@ -10,7 +10,7 @@ namespace OpenNest.Controls
{
///
/// Edits one contour type's lead-in and lead-out: a type list for each, the chosen type's
- /// fields below it, and a filling the rest. Cutting Settings and
+ /// fields below it, and a filling the rest. The Cutting Parameters dialog and
/// Machine Configuration both use it; the options hide what a host cannot hold.
///
public class LeadsEditor : UserControl
diff --git a/OpenNest/Forms/CuttingInspectionPanel.cs b/OpenNest/Forms/CuttingInspectionPanel.cs
index 29e6a2d2..3b8b1ed1 100644
--- a/OpenNest/Forms/CuttingInspectionPanel.cs
+++ b/OpenNest/Forms/CuttingInspectionPanel.cs
@@ -74,12 +74,12 @@ internal sealed class CuttingInspectionPanel : UserControl
AccessibleName = "Cutting plan remedy or marker hint"
};
private readonly ToolTip toolTip = new();
- private readonly Button settingsButton = new() { Text = "Cutting Settings…", AutoSize = true };
+ private readonly Button settingsButton = new() { Text = "Leads && Tabs…", AutoSize = true };
private readonly Button applyButton = new() { Text = "Apply", AutoSize = true, Enabled = false };
private readonly Button previousButton = new() { Text = "Previous", AutoSize = true };
private readonly Button nextButton = new() { Text = "Next", AutoSize = true };
private readonly CheckBox keepOrderCheckBox = new() { Text = "Keep current part order", AutoSize = true };
- private readonly CheckBox autoCutOffsCheckBox = new() { AutoSize = true, MaximumSize = new Size(440, 0) };
+ private readonly CheckBox autoCutOffsCheckBox = new() { Text = "Add scrap cut-offs", AutoSize = true, Anchor = AnchorStyles.Left };
private readonly StatusBanner existingWorkBanner = new() { Margin = new Padding(3, 3, 3, 8) };
private readonly Label existingWorkLabel = new()
{
@@ -96,7 +96,15 @@ internal sealed class CuttingInspectionPanel : UserControl
BackColor = SystemColors.Control,
UseVisualStyleBackColor = true
};
- private readonly Button cutOffSettingsButton = new() { Text = "Cut-off Settings…", AutoSize = true };
+ private readonly Button cutOffSettingsButton = new() { Text = "Strips…", AutoSize = true, Anchor = AnchorStyles.Left };
+ private readonly Label cutOffLabel = new()
+ {
+ AutoSize = true,
+ ForeColor = SystemColors.GrayText,
+ Anchor = AnchorStyles.Left,
+ };
+ private readonly GroupBox partCuttingGroup = SettingsGroup("Part cutting");
+ private readonly GroupBox cutOffGroup = SettingsGroup("Scrap cut-offs");
private readonly Units units;
private bool allPlates;
private AutomaticCutOffOptions cutOffOptions;
@@ -167,6 +175,10 @@ internal sealed class CuttingInspectionPanel : UserControl
var header = new FlowLayoutPanel { Dock = DockStyle.Fill, AutoSize = true, FlowDirection = FlowDirection.TopDown, WrapContents = false };
var settingsRow = new FlowLayoutPanel { AutoSize = true, WrapContents = false, Margin = Padding.Empty };
settingsRow.Controls.AddRange([settingsButton, settingsLabel]);
+ var partCuttingContent = GroupContent();
+ partCuttingContent.FlowDirection = FlowDirection.TopDown;
+ partCuttingContent.Controls.AddRange([settingsRow, keepOrderCheckBox]);
+ partCuttingGroup.Controls.Add(partCuttingContent);
var buttons = new FlowLayoutPanel { AutoSize = true, Margin = new Padding(0, 6, 0, 0) };
buttons.Controls.AddRange([planButton, applyButton, cancelButton]);
var navigation = new FlowLayoutPanel { AutoSize = true, Margin = Padding.Empty };
@@ -189,18 +201,13 @@ internal sealed class CuttingInspectionPanel : UserControl
units = editor.Nest.Units;
cutOffOptions = lastCutOffOptions.TryGetValue(units, out var last) ? Copy(last) : DefaultCutOffOptions(units);
ShowCutOffOptions();
- var cutOffRow = new FlowLayoutPanel
- {
- AutoSize = true,
- FlowDirection = FlowDirection.TopDown,
- WrapContents = false,
- Margin = Padding.Empty
- };
- cutOffRow.Controls.AddRange([autoCutOffsCheckBox, cutOffSettingsButton]);
+ var cutOffContent = GroupContent();
+ cutOffContent.Controls.AddRange([autoCutOffsCheckBox, cutOffSettingsButton, cutOffLabel]);
+ cutOffGroup.Controls.Add(cutOffContent);
existingWorkLabel.Font = new Font(Font, FontStyle.Bold);
existingWorkBanner.Controls.AddRange([existingWorkLabel, clearExistingButton]);
existingWorkBanner.SetTone(Tone.Bad);
- header.Controls.AddRange([modeSelector, scopeSelector, existingWorkBanner, settingsRow, keepOrderCheckBox, cutOffRow,
+ header.Controls.AddRange([modeSelector, scopeSelector, existingWorkBanner, partCuttingGroup, cutOffGroup,
validationScopeLabel, buttons, acceptWarningsCheckBox, navigation, previewLabel, detailLabel]);
statusBanner.Controls.Add(statusLabel);
var layout = new TableLayoutPanel { Dock = DockStyle.Fill, ColumnCount = 1, RowCount = 3 };
@@ -304,6 +311,9 @@ internal sealed class CuttingInspectionPanel : UserControl
internal AutomaticCutOffOptions CutOffOptions => Copy(cutOffOptions);
+ /// Shows the Leads & Tabs dialog; tests replace it. Null uses ShowDialog.
+ internal Func ShowCuttingSettings { get; set; }
+
private static AutomaticCutOffOptions Copy(AutomaticCutOffOptions options) => new()
{
Spacing = options.Spacing,
@@ -312,18 +322,38 @@ internal sealed class CuttingInspectionPanel : UserControl
KeepHorizontalRemnant = options.KeepHorizontalRemnant,
};
+ // A titled box around one set of planning options, so each settings button sits under its name.
+ private static GroupBox SettingsGroup(string title) => new()
+ {
+ Text = title,
+ AutoSize = true,
+ AutoSizeMode = AutoSizeMode.GrowAndShrink,
+ MinimumSize = new Size(440, 0),
+ Padding = new Padding(6, 3, 6, 3),
+ Margin = new Padding(3, 3, 3, 6),
+ };
+
+ private static FlowLayoutPanel GroupContent() => new()
+ {
+ Dock = DockStyle.Fill,
+ AutoSize = true,
+ WrapContents = false,
+ Margin = Padding.Empty,
+ };
+
private void ShowCutOffOptions()
{
var unit = UnitsHelper.GetShortString(units);
- autoCutOffsCheckBox.Text = $"Add scrap cut-offs ({cutOffOptions.Spacing:0.###} {unit} strips)";
- toolTip.SetToolTip(autoCutOffsCheckBox, $"Keeps tails of {cutOffOptions.MinimumTailLength:0.###} {unit} or more. "
+ cutOffLabel.Text = $"{cutOffOptions.Spacing:0.###} {unit} strips";
+ toolTip.SetToolTip(autoCutOffsCheckBox, $"Cuts the scrap into {cutOffOptions.Spacing:0.###} {unit} strips. Keeps tails of {cutOffOptions.MinimumTailLength:0.###} {unit} or more. "
+ "The cut-offs are added for planning and removed again unless you Apply.");
}
///
/// Opens the Automatic Scrap Cut-offs dialog in settings mode for this panel's scope. Unapplied
/// cut-offs come off first so its preview starts from the plates' real state; OK ticks the box
- /// and replans with the chosen settings, Cancel replans with the previous ones.
+ /// and replans with the chosen settings. Cancel keeps the current plan when nothing had to come
+ /// off for the dialog; otherwise it replans with the previous settings.
///
private void EditCutOffSettings()
{
@@ -343,17 +373,27 @@ internal sealed class CuttingInspectionPanel : UserControl
inspection.RequestClose();
return;
}
- ClearResult();
- try
+ // With nothing staged the dialog sees the plates as planned, so the plan only hides behind it.
+ var keepPlan = stagedCutOffs == null && Proposal != null && !invalidated;
+ if (keepPlan)
{
- RevertStagedCutOffs();
+ view.ClearProposalDisplay();
+ view.ClearValidationFinding();
}
- catch (Exception ex)
+ else
{
- SetStatus(Tone.Bad, "Couldn't remove the unapplied cut-offs.", ex.Message);
- return;
+ ClearResult();
+ try
+ {
+ RevertStagedCutOffs();
+ }
+ catch (Exception ex)
+ {
+ SetStatus(Tone.Bad, "Couldn't remove the unapplied cut-offs.", ex.Message);
+ return;
+ }
+ RefreshExistingWork();
}
- RefreshExistingWork();
AutomaticCutOffOptions chosen = null;
try
{
@@ -373,6 +413,13 @@ internal sealed class CuttingInspectionPanel : UserControl
}
if (closed || closeRequested)
return;
+ if (chosen == null && keepPlan)
+ {
+ ShowPlate(selectedPlate);
+ return;
+ }
+ if (keepPlan)
+ ClearResult();
if (chosen != null)
{
cutOffOptions = Copy(chosen);
@@ -423,8 +470,7 @@ internal sealed class CuttingInspectionPanel : UserControl
modeSelector.SelectedIndex = (int)Mode;
ShowScope(planning);
configuringMode = false;
- settingsButton.Visible = settingsLabel.Visible = keepOrderCheckBox.Visible = applyButton.Visible = planning;
- autoCutOffsCheckBox.Visible = cutOffSettingsButton.Visible = planning;
+ partCuttingGroup.Visible = cutOffGroup.Visible = applyButton.Visible = planning;
RefreshExistingWork();
previousButton.Visible = nextButton.Visible = planning && plates.Length > 1;
previewLabel.Visible = planning;
@@ -956,7 +1002,7 @@ internal sealed class CuttingInspectionPanel : UserControl
if (plate.Overlap is { } overlap && overlap.Pairs.Count > 0)
return "Move the overlapping parts apart, then Replan.";
if (!plate.IsRouteReady && plate.Result.Findings.Any(f => f.Kind == PostVerificationKind.MissingLeadIn))
- return "In Cutting Settings, choose a lead-in with a nonzero length (or unlock the part), then Replan.";
+ return "In Leads & Tabs, choose a lead-in with a nonzero length (or unlock the part), then Replan.";
if (plate.SearchLimitReached)
return "Raise Cut planning effort in Tools > Options to search further, then Replan; it may still find no plan.";
return null;
@@ -1269,8 +1315,12 @@ internal sealed class CuttingInspectionPanel : UserControl
Source = MachineSettings.DescribeCuttingSource(editor.Nest),
};
dialog.LoadParameters(parameters);
- if (dialog.ShowDialog(this) != DialogResult.OK || closed || closeRequested) return;
- parameters = dialog.GetParameters();
+ if ((ShowCuttingSettings?.Invoke(dialog) ?? dialog.ShowDialog(this)) != DialogResult.OK || closed || closeRequested)
+ return;
+ var edited = dialog.GetParameters();
+ if (CuttingParametersSerializer.Serialize(edited) == CuttingParametersSerializer.Serialize(parameters))
+ return; // OK with nothing changed keeps the current plan.
+ parameters = edited;
// Saved now, not only on Apply: a plate that will not plan must not lose the edit.
editor.SaveCuttingParameters(parameters);
ShowSettings();
diff --git a/docs/cutting-planner.md b/docs/cutting-planner.md
index 9f673749..7fb4973a 100644
--- a/docs/cutting-planner.md
+++ b/docs/cutting-planner.md
@@ -739,8 +739,12 @@ The former standalone planning dialog is retired; only the docked Plan/Validate
panel is wired in the editor. Non-editor callers still use the shared analyzer.
- The panel starts from the plate's cutting settings (or the last-used settings) and plans
- at once. `Cutting Settings...` edits them and `Keep the current part order` fixes the
- whole-part order; either change replans. The settings are confirmed parameters: every
+ at once. Its options sit in two titled groups so the two settings buttons are not
+ confused: **Part cutting** holds `Leads & Tabs...` (the Cutting Parameters dialog) with a
+ summary beside it, and **Scrap cut-offs** holds the cut-off box and `Strips...`.
+ `Leads & Tabs...` edits them and `Keep the current part order` fixes the
+ whole-part order; either change replans. Canceling the dialog, or OK with nothing
+ changed, keeps the current plan. The settings are confirmed parameters: every
unlocked part's lead-ins are regenerated. Locked parts keep their exact programs; their
own violations are fixed-lead warnings on an UNVERIFIED plate (see
[fixed emissions](#fixed-emissions-warn)), and any warnings require explicit review below.
@@ -766,9 +770,11 @@ panel is wired in the editor. Non-editor callers still use the shared analyzer.
restores the earlier cut-offs and sequence. The proposal preview draws planned cut-offs
with the same orange-red dashed line as the editor. A blocked cut-off plan adds nothing and
plans nothing; the panel names the plate and reason.
- `Cut-off Settings...` opens the Automatic Scrap Cut-offs dialog in settings mode for
+ `Strips...` opens the Automatic Scrap Cut-offs dialog in settings mode for
the same scope: it previews on the active plate as usual, but `Use These Settings`
- only returns the values (it adds nothing), ticks the box and replans. The panel
+ only returns the values (it adds nothing), ticks the box and replans. Cancel keeps the
+ current plan when the box is clear; with the box ticked the staged cut-offs had to come
+ off for the dialog, so Cancel stages them again and replans. The panel
remembers the last settings per unit system until the application closes. Cut-off
order follows the dependency rules above: crossing cut-offs before the parts they
pass through, sheet-separating cut-offs last.
diff --git a/docs/geometry/pierce-zone.md b/docs/geometry/pierce-zone.md
index 1ad7c1bf..94e1b3e9 100644
--- a/docs/geometry/pierce-zone.md
+++ b/docs/geometry/pierce-zone.md
@@ -1,7 +1,7 @@
# Pierce zones
On thick plate, a laser or plasma pierce blows a crater wider than the kerf. Set
-`CuttingParameters.PierceDiameter` (Cutting Settings, **Pierce Diameter**) to the crater's
+`CuttingParameters.PierceDiameter` (Leads & Tabs, **Pierce Diameter**) to the crater's
diameter for that machine, material and thickness. 0, the default, turns the zone off, and
lead generation, planning and posting then behave exactly as before.