fix(ui): keep Draw Support visible while inspecting a cutting plan

The support overlay was drawn inside the live-plate-only paint block, and
the Plan Cutting preview plate never copied the support bed, so opening
the cut planner hid the grid points and each part's support marks. The
overlay now follows the displayed plate, the preview carries the bed, and
tab-point clearance falls back to the live plate's tab size.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ajandClaude Opus 5.5 committed 2026-10-27 13:25:09 -04:00
1 parent eedff85904
commit 58b8467c39
5 files changed
+24 -5

No files matched your search

@@ -447,6 +447,8 @@ public sealed class CuttingPlanProposal
Quadrant = source.Quadrant,
PartSpacing = source.PartSpacing,
EdgeSpacing = source.EdgeSpacing,
// View > Draw Support shows the proposal on the same bed.
SupportBed = source.SupportBed,
};
// Machine clamps stay visible while inspecting the proposal; zones are immutable.
foreach (var zone in source.ClampZones)
@@ -19,4 +19,17 @@ public class ClampZonePreviewTests
Assert.Equal(2, preview.ClampZones.Count);
Assert.Null(preview.ClampRail); // a detached display copy never re-resolves
}
[Fact]
public void PreviewCarriesThePlatesSupportBed()
{
var plate = BestEffortCuttingPlanTests.Plate(BestEffortCuttingPlanTests.TouchingContours());
plate.SupportBed = new OpenNest.Support.SupportGrid(25, 100, 2, 2, stabilityMargin: 0.1);
var proposal = CuttingPlanBatch.Capture([plate], ExplicitContourTests.Parameters(), false).Plan();
var preview = proposal.BuildPreview(0);
Assert.NotNull(preview);
Assert.Same(plate.SupportBed, preview.SupportBed);
}
}
+3 -2
View File
@@ -771,10 +771,11 @@ namespace OpenNest.Controls
{
renderer.DrawActiveWorkArea(e.Graphics);
renderer.DrawDebugRemnants(e.Graphics);
if (DrawSupport)
supportOverlay.Draw(e.Graphics, this);
DrawOverlapOverlay(e.Graphics);
}
// The support overlay follows the displayed plate, so it shows a proposal's tabbed parts too.
if (DrawSupport)
supportOverlay.Draw(e.Graphics, this);
// Plan Cutting marks findings on its proposal as well as on the live plate.
validationOverlay.Draw(e.Graphics);
if (!HasProposalDisplay)
+4 -2
View File
@@ -49,8 +49,10 @@ namespace OpenNest.Controls
using var supportedPen = new Pen(SupportedColor, 2f);
using var tippingPen = new Pen(TippingColor, 2f);
using var tabBrush = new SolidBrush(TabColor);
// Tab points keep clear of inside corners as Plan Cutting's do.
var clearance = SupportAnalyzer.InsideCornerClearance(plate.CuttingParameters?.TabConfig?.Size ?? 0);
// Tab points keep clear of inside corners as Plan Cutting's do. A proposal preview has no
// parameters of its own, so it uses the live plate's.
var parameters = plate.CuttingParameters ?? view.Plate?.CuttingParameters;
var clearance = SupportAnalyzer.InsideCornerClearance(parameters?.TabConfig?.Size ?? 0);
foreach (var part in plate.Parts)
{
if (part?.BaseDrawing == null || part.BaseDrawing.IsCutOff)
+2 -1
View File
@@ -75,7 +75,8 @@ inside corner. Only when every outline point is too close does the clearance giv
View > Draw Support shows the grid or the slats, cut off to the sheet (while its points or slats
are at least 6 pixels apart), each part's
contacts, and its center of gravity: green when supported, red when it can tip, with an orange
diamond on a red part's best tab point (keeping the plate's tab-size clearance).
diamond on a red part's best tab point (keeping the plate's tab-size clearance). While Plan
Cutting inspects a proposal, the overlay shows the proposal's parts on the same bed.
## Support tabs in Plan Cutting