mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-29 01:31:34 -05:00
feat(desktop): mark cut-plan issues on the plate and trim the inspection panel
Plan Cutting findings dropped the checker's geometry, so selecting one could only zoom to part extents, and overlap-blocked plates (no preview) did nothing at all. Findings now keep the check's world-coordinate witness (overlap regions, rapid, contacts); selecting a row draws it with the Validate Nest overlay, on the proposal or a blocked plate's live sheet. The witness is excluded from finding equality so repeated search rejections still collapse to one finding. The side panel's scrolling report was a wall of text operators skipped. It is now a colored outcome line, one line for the shown plate, and one remedy or marker hint above the issue grid, with secondary detail moved to tooltips. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
658c1c9ee3
commit
c3fa8e79e0
10 files changed
+379
-147
No files matched your search
@@ -171,13 +171,13 @@ public class CuttingInspectionPanelTests
|
||||
var panel = editor.CuttingInspection!;
|
||||
PumpUntil(() => panel.Proposal != null && !panel.IsPlanning);
|
||||
Assert.Equal(2, panel.Proposal.Plates.Count);
|
||||
Assert.Equal(ScrollBars.Vertical, Field<TextBox>(panel, "resultLabel").ScrollBars);
|
||||
Assert.Contains("Can't apply", Field<Label>(panel, "statusLabel").Text);
|
||||
Assert.False(Field<Button>(panel, "applyButton").Enabled);
|
||||
Assert.True(editor.PlateView.HasProposalDisplay);
|
||||
Field<Button>(panel, "nextButton").PerformClick();
|
||||
Assert.Same(second, editor.PlateView.Plate); // Refusal shows the requested live plate, not the opening plate.
|
||||
Assert.False(editor.PlateView.HasProposalDisplay);
|
||||
Assert.Contains("no current preview", Field<Label>(panel, "previewLabel").Text);
|
||||
Assert.Contains("blocked", Field<Label>(panel, "previewLabel").Text);
|
||||
var grid = Field<DataGridView>(panel, "warningGrid");
|
||||
Assert.Equal(panel.Proposal.DiagnosticRows().Count, grid.Rows.Count);
|
||||
var row = grid.Rows.Cast<DataGridViewRow>().First(r => r.Tag is OpenNest.Engine.CuttingPlanning.CuttingPlanDiagnosticRow d && d.PlateIndex == 1);
|
||||
@@ -189,6 +189,34 @@ public class CuttingInspectionPanelTests
|
||||
Assert.Same(original, editor.PlateView.Plate);
|
||||
});
|
||||
|
||||
[Fact]
|
||||
public void BlockedOverlapRowShadesTheOverlapOnTheLivePlate() => RunSta(() =>
|
||||
{
|
||||
using var editor = Editor();
|
||||
var plate = editor.Nest.Plates[0];
|
||||
plate.Parts.Add(Square("overlapping", 5));
|
||||
editor.Show();
|
||||
editor.PlateManager.LoadAt(0);
|
||||
editor.OpenCuttingInspection();
|
||||
var panel = editor.CuttingInspection!;
|
||||
PumpUntil(() => panel.Proposal != null && !panel.IsPlanning);
|
||||
Assert.False(Field<Button>(panel, "applyButton").Enabled);
|
||||
Assert.Contains("Can't apply", Field<Label>(panel, "statusLabel").Text);
|
||||
Assert.Contains("parts overlap", Field<Label>(panel, "previewLabel").Text);
|
||||
var view = editor.PlateView;
|
||||
Assert.False(view.HasProposalDisplay);
|
||||
var grid = Field<DataGridView>(panel, "warningGrid");
|
||||
var row = grid.Rows.Cast<DataGridViewRow>().First(r =>
|
||||
r.Tag is OpenNest.Engine.CuttingPlanning.CuttingPlanDiagnosticRow { Witness.Overlap: not null });
|
||||
grid.ClearSelection();
|
||||
row.Selected = true;
|
||||
Assert.Same(plate, view.Plate);
|
||||
Assert.NotNull(view.ValidationOverlay.Finding?.Overlap);
|
||||
Assert.Contains("overlapping material", Field<Label>(panel, "detailLabel").Text);
|
||||
panel.RequestClose();
|
||||
Assert.Null(view.ValidationOverlay.Finding);
|
||||
});
|
||||
|
||||
[Fact]
|
||||
public void NextAndPreviousShowTheSelectedReadyPlateNotTheOpeningPlate() => RunSta(() =>
|
||||
{
|
||||
@@ -260,7 +288,10 @@ public class CuttingInspectionPanelTests
|
||||
var partRow = grid.Rows.Cast<DataGridViewRow>().First(r => r.Cells[1].Value is int);
|
||||
grid.ClearSelection();
|
||||
partRow.Selected = true;
|
||||
Assert.Contains("affected part extent", Field<Label>(panel, "previewLabel").Text);
|
||||
if (partRow.Tag is OpenNest.Engine.CuttingPlanning.CuttingPlanDiagnosticRow { Witness.Location: not null })
|
||||
Assert.NotNull(editor.PlateView.ValidationOverlay.Finding);
|
||||
else
|
||||
Assert.Contains("affected part", Field<Label>(panel, "detailLabel").Text);
|
||||
Field<Button>(panel, "applyButton").PerformClick();
|
||||
Assert.Null(panel.CommitResult);
|
||||
Assert.All(plate.Parts, part => Assert.False(part.HasManualLeadIns));
|
||||
@@ -287,7 +318,7 @@ public class CuttingInspectionPanelTests
|
||||
Assert.False(editor.PlateView.HasProposalDisplay);
|
||||
Assert.False(Field<Button>(panel, "applyButton").Enabled);
|
||||
Assert.False(Field<CheckBox>(panel, "acceptWarningsCheckBox").Checked);
|
||||
Assert.Contains("Replan", Field<TextBox>(panel, "resultLabel").Text);
|
||||
Assert.Contains("Replan", Field<Label>(panel, "statusLabel").Text);
|
||||
Assert.Equal(programs, plate.Parts.Select(p => p.Program));
|
||||
Assert.All(plate.Parts, p => Assert.False(p.HasManualLeadIns));
|
||||
panel.StartPlanning();
|
||||
@@ -349,7 +380,7 @@ public class CuttingInspectionPanelTests
|
||||
Assert.False(Field<Button>(panel, "applyButton").Enabled);
|
||||
Assert.False(Field<CheckBox>(panel, "acceptWarningsCheckBox").Checked);
|
||||
Assert.False(editor.PlateView.HasProposalDisplay);
|
||||
Assert.Contains("Nothing can be applied", Field<TextBox>(panel, "resultLabel").Text);
|
||||
Assert.Contains("Nothing can be applied", Field<Label>(panel, "statusLabel").Text);
|
||||
Assert.Equal(original, editor.PlateView.Plate.Parts);
|
||||
panel.RequestClose();
|
||||
});
|
||||
|
||||
@@ -57,10 +57,10 @@ public class CuttingValidationPanelTests
|
||||
Assert.Contains(Enumerable.Range(-2, 5).SelectMany(dx => Enumerable.Range(3, 7)
|
||||
.Select(dy => bitmap.GetPixel(cx + dx, cy + dy))), pixel =>
|
||||
pixel.R > 150 && pixel.B > 50 && pixel.G < 100);
|
||||
Assert.Contains("Crosshairs", Field<TextBox>(panel, "resultLabel").Text);
|
||||
Assert.Contains("Confirm minimum spacing, plate boundaries and final post output separately", Field<Label>(panel, "validationScopeLabel").Text);
|
||||
Assert.Contains("crosshairs", Field<Label>(panel, "detailLabel").Text);
|
||||
Assert.Contains("Spacing, plate edges and post output are not checked", Field<Label>(panel, "validationScopeLabel").Text);
|
||||
Assert.True(Field<Label>(panel, "validationScopeLabel").Visible);
|
||||
Assert.Contains("Nest validation (live programs)", Field<TextBox>(panel, "resultLabel").Text);
|
||||
Assert.Contains("rapid crossing", Field<Label>(panel, "statusLabel").Text);
|
||||
panel.RequestClose();
|
||||
Assert.Same(original, view.Plate);
|
||||
Assert.Equal(viewport, view.CaptureViewport());
|
||||
@@ -82,9 +82,9 @@ public class CuttingValidationPanelTests
|
||||
editor.OpenValidationInspection();
|
||||
var panel = editor.CuttingInspection!;
|
||||
Pump(() => panel.ValidationReport != null && !panel.IsPlanning);
|
||||
Assert.Contains(incomplete ? "Validation incomplete" : "No warnings found", Field<Label>(panel, "previewLabel").Text);
|
||||
Assert.Contains(incomplete ? "Validation incomplete" : "No warnings found", Field<Label>(panel, "statusLabel").Text);
|
||||
Assert.True(Field<Label>(panel, "validationScopeLabel").Visible);
|
||||
Assert.Contains("LIVE NEST only", Field<Label>(panel, "validationScopeLabel").Text);
|
||||
Assert.Contains("live nest", Field<Label>(panel, "validationScopeLabel").Text);
|
||||
Assert.False(Field<Button>(panel, "applyButton").Enabled);
|
||||
panel.RequestClose();
|
||||
});
|
||||
@@ -184,8 +184,8 @@ public class CuttingValidationPanelTests
|
||||
Assert.Null(panel.ValidationReport);
|
||||
Assert.Null(editor.PlateView.ValidationOverlay.Finding);
|
||||
Assert.Empty(Field<DataGridView>(panel, "warningGrid").Rows.Cast<DataGridViewRow>());
|
||||
Assert.Contains("Validation failed", Field<TextBox>(panel, "resultLabel").Text);
|
||||
Assert.DoesNotContain("No warnings found", Field<Label>(panel, "previewLabel").Text);
|
||||
Assert.Contains("Validation failed", Field<Label>(panel, "statusLabel").Text);
|
||||
Assert.DoesNotContain("No warnings found", Field<Label>(panel, "statusLabel").Text);
|
||||
panel.RequestClose();
|
||||
});
|
||||
|
||||
@@ -245,13 +245,12 @@ public class CuttingValidationPanelTests
|
||||
Assert.True(grid.ReadOnly);
|
||||
Assert.Equal(DataGridViewSelectionMode.FullRowSelect, grid.SelectionMode);
|
||||
Assert.All(grid.Columns.Cast<DataGridViewColumn>(), c => Assert.Equal(DataGridViewColumnSortMode.NotSortable, c.SortMode));
|
||||
Assert.True(Field<TextBox>(panel, "resultLabel").ReadOnly);
|
||||
var row = grid.Rows.Cast<DataGridViewRow>().Single(r => r.Tag is PostVerificationFinding { Kind: PostVerificationKind.Overlap });
|
||||
row.Selected = true;
|
||||
var view = editor.PlateView;
|
||||
Assert.Same(plate, view.Plate);
|
||||
Assert.NotNull(view.ValidationOverlay.Finding.Overlap);
|
||||
Assert.Contains("largest patch", Field<TextBox>(panel, "resultLabel").Text);
|
||||
Assert.Contains("overlapping material", Field<Label>(panel, "detailLabel").Text);
|
||||
var scale = view.ViewScale;
|
||||
InvokeView(view, "OnMouseWheel", new MouseEventArgs(MouseButtons.None, 0, 100, 100, 120));
|
||||
Assert.True(view.ViewScale > scale);
|
||||
|
||||
Reference in new issue
Block a user