From 76e1acbc514a5959af88d29dbd94dec2d7e60f8c Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Thu, 12 Nov 2026 07:16:09 -0500 Subject: [PATCH] fix(reports): take the thickness name from the machine config Each machine thickness already has a Name / Gauge field the shop fills in, so the report now shows that name instead of guessing one from the standard gauge table. It is matched the way the machine cutting defaults match the nest's material, grade and thickness; a thickness without a name shows just the decimal. Co-Authored-By: Claude Opus 5.5 --- OpenNest.Reporting/NestPdfWriter.cs | 2 +- OpenNest.Reporting/NestReportSnapshot.cs | 6 +++--- OpenNest/Forms/EditNestForm.cs | 7 ++++--- docs/nest-reports.md | 9 +++++---- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/OpenNest.Reporting/NestPdfWriter.cs b/OpenNest.Reporting/NestPdfWriter.cs index 31661fe2..d0b31c0a 100644 --- a/OpenNest.Reporting/NestPdfWriter.cs +++ b/OpenNest.Reporting/NestPdfWriter.cs @@ -729,7 +729,7 @@ public static class NestPdfWriter } // Zero thickness means "unset" in a new nest; never present it as a genuine value. - // A standard gauge or plate fraction leads, as the thickness box lists it: "16 ga - 0.0598 in". + // The machine config's name for the thickness leads: "16 ga - 0.0598 in". private static string Thickness(NestReportSnapshot snapshot) => snapshot.Thickness <= 0 ? "Not specified" : snapshot.ThicknessName.Length > 0 ? $"{snapshot.ThicknessName} - {Number(snapshot.Thickness)} {snapshot.Units}" diff --git a/OpenNest.Reporting/NestReportSnapshot.cs b/OpenNest.Reporting/NestReportSnapshot.cs index 46e9435f..d93b4f4a 100644 --- a/OpenNest.Reporting/NestReportSnapshot.cs +++ b/OpenNest.Reporting/NestReportSnapshot.cs @@ -63,9 +63,9 @@ public sealed record NestReportSnapshot(string Name, string Customer, string Not public long TotalSheets => Plates.Aggregate(0L, (total, plate) => checked(total + plate.Copies)); /// - /// The standard gauge or plate fraction the thickness matches ("16 ga", "1/4\""), shown - /// before the decimal; empty when it matches none. Reporting has no thickness table of its - /// own, so the caller supplies it. + /// The name the nest machine's config gives this thickness ("16 ga"), shown before the + /// decimal; empty when it has none. Reporting does not read machine configs, so the caller + /// supplies it. /// public string ThicknessName { get; init; } = ""; diff --git a/OpenNest/Forms/EditNestForm.cs b/OpenNest/Forms/EditNestForm.cs index 18b456e7..b9f5ebb8 100644 --- a/OpenNest/Forms/EditNestForm.cs +++ b/OpenNest/Forms/EditNestForm.cs @@ -848,10 +848,11 @@ namespace OpenNest.Forms // Reporting must have no accounting side effects: no quantity refresh, no // selection or dirty-state change. Only the detached snapshot reaches the writer. var material = targets.Nest.Material; + var machine = MachineSettings.FindMachine(targets.Nest.Machine); var catalogDensity = Data.MaterialDensityLookup.Resolve( material?.Name, material?.Grade, - MachineSettings.FindMachine(targets.Nest.Machine), + machine, MachineSettings.LoadMaterials() ); var snapshot = NestReportBuilder.Capture( @@ -861,8 +862,8 @@ namespace OpenNest.Forms catalogDensity ) with { - ThicknessName = - Data.StandardThicknesses.Find(targets.Nest.Thickness, targets.Nest.Units)?.Name ?? "", + // The name the machine config gives the nest's thickness ("16 ga"), if any. + ThicknessName = Data.MachineCuttingDefaults.Find(machine, targets.Nest)?.Name?.Trim() ?? "", }; NestPdfWriter.Write(snapshot, destination); } diff --git a/docs/nest-reports.md b/docs/nest-reports.md index 4efd42fb..83e9d84a 100644 --- a/docs/nest-reports.md +++ b/docs/nest-reports.md @@ -112,10 +112,11 @@ beside the ID; complete drawings show no status. Cards without a weight show a table row, so a card never splits across pages. The summary's header lists the job and material on the left and the totals on -the right, to leave room for part cards on the first page. A thickness that -matches a standard gauge or plate fraction leads with its name, as the -thickness box lists it ("16 ga - 0.0598 in"); the desktop supplies the name, -since Reporting has no thickness table of its own. +the right, to leave room for part cards on the first page. When the nest +machine's config names the thickness (its **Name / Gauge**, matched as the +[machine cutting defaults](machine-cutting-defaults.md) match it), the name +leads the decimal: "16 ga - 0.0598 in". The desktop supplies it, since +Reporting does not read machine configs. Stock sizes read **width x length** in job units. Plate tables use **Quantity** and **Parts per plate**; the plate quantity multiplies per-plate part counts for