mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-18 20:57:40 -05:00
refactor(overlap): drop Check Active Plate and Cancel Check from the menu
The nest window rechecks the active plate automatically half a second after each edit, so a manual run/cancel pair in View > Overlap Check is redundant. With only Display left, its Off/Areas/Markers/Both items move up to sit directly under Overlap Check. Auto Nest still runs its explicit check, and undo/redo still cancel a running check internally. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7f92a637d7
commit
c10abfe996
4 files changed
+21
-62
No files matched your search
@@ -578,29 +578,28 @@ public class PlateOverlapOverlayTests
|
|||||||
});
|
});
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void MenusFollowMdiActivationDocumentDisplayAndRunningState() => RunSta(() =>
|
public void MenusFollowMdiActivationAndDocumentDisplay() => RunSta(() =>
|
||||||
{
|
{
|
||||||
using var host = new MenuHost();
|
using var host = new MenuHost();
|
||||||
host.Show();
|
host.Show();
|
||||||
var check = Menu(host, "mnuOverlapCheckActive");
|
var overlap = Menu(host, "mnuViewOverlapCheck");
|
||||||
var cancel = Menu(host, "mnuOverlapCancel");
|
|
||||||
var off = Menu(host, "mnuOverlapOff");
|
var off = Menu(host, "mnuOverlapOff");
|
||||||
var areas = Menu(host, "mnuOverlapAreas");
|
var areas = Menu(host, "mnuOverlapAreas");
|
||||||
var centroids = Menu(host, "mnuOverlapCentroids");
|
var centroids = Menu(host, "mnuOverlapCentroids");
|
||||||
var both = Menu(host, "mnuOverlapBoth");
|
var both = Menu(host, "mnuOverlapBoth");
|
||||||
Assert.False(check.Enabled);
|
Assert.False(overlap.Enabled);
|
||||||
Assert.False(cancel.Enabled);
|
|
||||||
Assert.False(off.Enabled);
|
Assert.False(off.Enabled);
|
||||||
Assert.False(areas.Enabled);
|
Assert.False(areas.Enabled);
|
||||||
Assert.False(centroids.Enabled);
|
Assert.False(centroids.Enabled);
|
||||||
Assert.False(both.Enabled);
|
Assert.False(both.Enabled);
|
||||||
Assert.All(new[] { check, cancel, off, areas, centroids, both }, item => Assert.Equal(Keys.None, item.ShortcutKeys));
|
Assert.All(new[] { overlap, off, areas, centroids, both }, item => Assert.Equal(Keys.None, item.ShortcutKeys));
|
||||||
|
|
||||||
using var first = new EditNestForm(new Nest("first")) { MdiParent = host };
|
using var first = new EditNestForm(new Nest("first")) { MdiParent = host };
|
||||||
// Manual-command test: an auto-check timer pumped during a wait would race its requests.
|
// Manual-command test: an auto-check timer pumped during a wait would race its requests.
|
||||||
first.PlateView.SetOverlapAutoCheck(null);
|
first.PlateView.SetOverlapAutoCheck(null);
|
||||||
first.Show();
|
first.Show();
|
||||||
Assert.True(check.Enabled);
|
Assert.True(overlap.Enabled);
|
||||||
|
Assert.True(off.Enabled);
|
||||||
Assert.True(areas.Checked);
|
Assert.True(areas.Checked);
|
||||||
off.PerformClick();
|
off.PerformClick();
|
||||||
Assert.Equal(OverlapDisplayMode.Off, first.OverlapDisplay);
|
Assert.Equal(OverlapDisplayMode.Off, first.OverlapDisplay);
|
||||||
@@ -641,10 +640,8 @@ public class PlateOverlapOverlayTests
|
|||||||
};
|
};
|
||||||
var task = first.CheckOverlapsAsync();
|
var task = first.CheckOverlapsAsync();
|
||||||
Assert.True(pending.TryTake(out var request, TimeSpan.FromSeconds(15)));
|
Assert.True(pending.TryTake(out var request, TimeSpan.FromSeconds(15)));
|
||||||
Assert.True(cancel.Enabled);
|
|
||||||
Assert.True(areas.Checked); // Checking from Off selects Areas.
|
Assert.True(areas.Checked); // Checking from Off selects Areas.
|
||||||
cancel.PerformClick();
|
first.CancelOverlapCheck();
|
||||||
Assert.False(cancel.Enabled);
|
|
||||||
Assert.True(request!.Token.IsCancellationRequested);
|
Assert.True(request!.Token.IsCancellationRequested);
|
||||||
request.Complete();
|
request.Complete();
|
||||||
context.Pump(task);
|
context.Pump(task);
|
||||||
@@ -656,8 +653,8 @@ public class PlateOverlapOverlayTests
|
|||||||
}
|
}
|
||||||
first.Dispose();
|
first.Dispose();
|
||||||
second.Dispose();
|
second.Dispose();
|
||||||
Assert.False(check.Enabled);
|
Assert.False(overlap.Enabled);
|
||||||
Assert.False(cancel.Enabled);
|
Assert.False(off.Enabled);
|
||||||
});
|
});
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -1192,7 +1189,7 @@ public class PlateOverlapOverlayTests
|
|||||||
Assert.Equal(OverlapDisplayMode.Off, run.View.OverlapDisplay);
|
Assert.Equal(OverlapDisplayMode.Off, run.View.OverlapDisplay);
|
||||||
|
|
||||||
run.View.Plate.Parts[1].Offset(0.25, 0);
|
run.View.Plate.Parts[1].Offset(0.25, 0);
|
||||||
task = run.Start(); // manual Check Active Plate
|
task = run.Start(); // explicit check, as Auto Nest runs
|
||||||
run.Next().Complete();
|
run.Next().Complete();
|
||||||
run.Pump(task);
|
run.Pump(task);
|
||||||
Assert.Equal(OverlapDisplayMode.Areas, run.View.OverlapDisplay);
|
Assert.Equal(OverlapDisplayMode.Areas, run.View.OverlapDisplay);
|
||||||
|
|||||||
Generated
+1
-26
@@ -66,9 +66,6 @@ namespace OpenNest.Forms
|
|||||||
mnuEditSelectAll = new System.Windows.Forms.ToolStripMenuItem();
|
mnuEditSelectAll = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
mnuView = new System.Windows.Forms.ToolStripMenuItem();
|
mnuView = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
mnuViewOverlapCheck = new System.Windows.Forms.ToolStripMenuItem();
|
mnuViewOverlapCheck = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
mnuOverlapCheckActive = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
mnuOverlapCancel = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
mnuOverlapDisplay = new System.Windows.Forms.ToolStripMenuItem();
|
|
||||||
mnuOverlapOff = new System.Windows.Forms.ToolStripMenuItem();
|
mnuOverlapOff = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
mnuOverlapAreas = new System.Windows.Forms.ToolStripMenuItem();
|
mnuOverlapAreas = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
mnuOverlapCentroids = new System.Windows.Forms.ToolStripMenuItem();
|
mnuOverlapCentroids = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
@@ -432,28 +429,9 @@ namespace OpenNest.Forms
|
|||||||
//
|
//
|
||||||
mnuViewOverlapCheck.Name = "mnuViewOverlapCheck";
|
mnuViewOverlapCheck.Name = "mnuViewOverlapCheck";
|
||||||
mnuViewOverlapCheck.Text = "Overlap Check";
|
mnuViewOverlapCheck.Text = "Overlap Check";
|
||||||
mnuViewOverlapCheck.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { mnuOverlapCheckActive, mnuOverlapCancel, mnuOverlapDisplay });
|
mnuViewOverlapCheck.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { mnuOverlapOff, mnuOverlapAreas, mnuOverlapCentroids, mnuOverlapBoth });
|
||||||
mnuViewOverlapCheck.DropDownOpening += OverlapMenu_Opening;
|
mnuViewOverlapCheck.DropDownOpening += OverlapMenu_Opening;
|
||||||
//
|
//
|
||||||
// mnuOverlapCheckActive
|
|
||||||
//
|
|
||||||
mnuOverlapCheckActive.Name = "mnuOverlapCheckActive";
|
|
||||||
mnuOverlapCheckActive.Text = "Check Active Plate";
|
|
||||||
mnuOverlapCheckActive.Click += CheckOverlaps_Click;
|
|
||||||
//
|
|
||||||
// mnuOverlapCancel
|
|
||||||
//
|
|
||||||
mnuOverlapCancel.Name = "mnuOverlapCancel";
|
|
||||||
mnuOverlapCancel.Text = "Cancel Check";
|
|
||||||
mnuOverlapCancel.Click += CancelOverlapCheck_Click;
|
|
||||||
//
|
|
||||||
// mnuOverlapDisplay
|
|
||||||
//
|
|
||||||
mnuOverlapDisplay.Name = "mnuOverlapDisplay";
|
|
||||||
mnuOverlapDisplay.Text = "Display";
|
|
||||||
mnuOverlapDisplay.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { mnuOverlapOff, mnuOverlapAreas, mnuOverlapCentroids, mnuOverlapBoth });
|
|
||||||
mnuOverlapDisplay.DropDownOpening += OverlapMenu_Opening;
|
|
||||||
//
|
|
||||||
// mnuOverlapOff
|
// mnuOverlapOff
|
||||||
//
|
//
|
||||||
mnuOverlapOff.Name = "mnuOverlapOff";
|
mnuOverlapOff.Name = "mnuOverlapOff";
|
||||||
@@ -1478,9 +1456,6 @@ namespace OpenNest.Forms
|
|||||||
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 mnuViewOverlapCheck;
|
private System.Windows.Forms.ToolStripMenuItem mnuViewOverlapCheck;
|
||||||
private System.Windows.Forms.ToolStripMenuItem mnuOverlapCheckActive;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem mnuOverlapCancel;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem mnuOverlapDisplay;
|
|
||||||
private System.Windows.Forms.ToolStripMenuItem mnuOverlapOff;
|
private System.Windows.Forms.ToolStripMenuItem mnuOverlapOff;
|
||||||
private System.Windows.Forms.ToolStripMenuItem mnuOverlapAreas;
|
private System.Windows.Forms.ToolStripMenuItem mnuOverlapAreas;
|
||||||
private System.Windows.Forms.ToolStripMenuItem mnuOverlapCentroids;
|
private System.Windows.Forms.ToolStripMenuItem mnuOverlapCentroids;
|
||||||
|
|||||||
@@ -57,9 +57,6 @@ namespace OpenNest.Forms
|
|||||||
{
|
{
|
||||||
var hasPlate = activeForm != null && !activeForm.IsDisposed && activeForm.PlateView.Plate != null;
|
var hasPlate = activeForm != null && !activeForm.IsDisposed && activeForm.PlateView.Plate != null;
|
||||||
mnuViewOverlapCheck.Enabled = hasPlate;
|
mnuViewOverlapCheck.Enabled = hasPlate;
|
||||||
mnuOverlapCheckActive.Enabled = hasPlate;
|
|
||||||
mnuOverlapCancel.Enabled = hasPlate && activeForm.PlateView.IsOverlapCheckRunning;
|
|
||||||
mnuOverlapDisplay.Enabled = hasPlate;
|
|
||||||
mnuOverlapOff.Enabled = hasPlate;
|
mnuOverlapOff.Enabled = hasPlate;
|
||||||
mnuOverlapAreas.Enabled = hasPlate;
|
mnuOverlapAreas.Enabled = hasPlate;
|
||||||
mnuOverlapCentroids.Enabled = hasPlate;
|
mnuOverlapCentroids.Enabled = hasPlate;
|
||||||
@@ -70,15 +67,6 @@ namespace OpenNest.Forms
|
|||||||
mnuOverlapBoth.Checked = hasPlate && activeForm.OverlapDisplay == OverlapDisplayMode.Both;
|
mnuOverlapBoth.Checked = hasPlate && activeForm.OverlapDisplay == OverlapDisplayMode.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void CheckOverlaps_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var form = activeForm;
|
|
||||||
if (form != null)
|
|
||||||
await form.CheckOverlapsAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CancelOverlapCheck_Click(object sender, EventArgs e) => activeForm?.CancelOverlapCheck();
|
|
||||||
|
|
||||||
private void OverlapOff_Click(object sender, EventArgs e)
|
private void OverlapOff_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (activeForm != null)
|
if (activeForm != null)
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
## Desktop use
|
## Desktop use
|
||||||
|
|
||||||
Choose **View > Overlap Check > Check Active Plate** to check committed parts on
|
A nest window checks committed parts on its active plate automatically (see below);
|
||||||
this plate. Shared material is shaded red/magenta without changing the nest,
|
there is no menu command to run or cancel a check. Shared material is shaded
|
||||||
selection, cutting paths, or export behavior. Cutoffs and temporary preview parts
|
red/magenta without changing the nest, selection, cutting paths, or export
|
||||||
are excluded. **Cancel Check** discards the running request. **Display > Off /
|
behavior. Cutoffs and temporary preview parts are excluded. **View > Overlap
|
||||||
Areas / Markers / Both** changes visibility without rerunning analysis. Areas
|
Check > Off / Areas / Markers / Both** changes visibility without rerunning
|
||||||
is the default; rechecking preserves a visible mode, while checking from Off
|
analysis. Areas is the default; an explicit check (the one Auto Nest runs when it
|
||||||
shows Areas. Clamp overlaps are shown as part/clamp findings with the clamp ID
|
finishes) preserves a visible mode, while checking from Off shows Areas. Clamp overlaps are shown as part/clamp findings with the clamp ID
|
||||||
in hover details; clamps are not selectable parts and are not added to quantity
|
in hover details; clamps are not selectable parts and are not added to quantity
|
||||||
or machining. A clamp edit invalidates the diagnostic and schedules a fresh
|
or machining. A clamp edit invalidates the diagnostic and schedules a fresh
|
||||||
check. Display preferences belong to the current document and are not saved.
|
check. Display preferences belong to the current document and are not saved.
|
||||||
@@ -76,12 +76,11 @@ mouse button, modal dialog, or fill progress window is active, the check reruns.
|
|||||||
Automatic results do not replace the status bar's message, so it keeps the last
|
Automatic results do not replace the status bar's message, so it keeps the last
|
||||||
command's text; a separate **Layout** section beside utilization follows the check
|
command's text; a separate **Layout** section beside utilization follows the check
|
||||||
instead, as `Layout: OK`, `Layout: checking…` or `Layout: 1 overlap, 3 too close`,
|
instead, as `Layout: OK`, `Layout: checking…` or `Layout: 1 overlap, 3 too close`,
|
||||||
in red for findings or an unfinished check, with the full wording in its tooltip, and an automatic check keeps Display > Off rather than
|
in red for findings or an unfinished check, with the full wording in its tooltip, and an automatic check keeps Off rather than
|
||||||
switching to Areas. Rechecks are incremental: drawing material is prepared once
|
switching to Areas. Rechecks are incremental: drawing material is prepared once
|
||||||
and reused, and pairs whose two parts have not moved reuse the previous result,
|
and reused, and pairs whose two parts have not moved reuse the previous result,
|
||||||
so only the moved parts' neighbors are clipped again. Canceling a check is
|
so only the moved parts' neighbors are clipped again. A failed layout is not
|
||||||
respected until the layout changes again, and a failed layout is not retried
|
retried until it changes.
|
||||||
until it changes. Check Active Plate remains available and always runs at once.
|
|
||||||
|
|
||||||
Plate changes reset the check. Pan, zoom, selection, and display changes do not
|
Plate changes reset the check. Pan, zoom, selection, and display changes do not
|
||||||
rerun geometry. Drawing-editor loading invalidates before loading (dropping cached
|
rerun geometry. Drawing-editor loading invalidates before loading (dropping cached
|
||||||
|
|||||||
Reference in new issue
Block a user