From afa50c5a123b8529875089bd81d70532665e8f1c Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Sat, 10 Oct 2026 13:14:19 -0400 Subject: [PATCH] fix(report): display stock dimensions as width by length --- OpenNest.Reporting/NestPdfWriter.cs | 2 +- OpenNest.Tests/Reporting/NestPdfLayoutTests.cs | 4 ++-- OpenNest.Tests/Reporting/NestPdfWriterTests.cs | 2 +- docs/nest-reports.md | 2 ++ 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/OpenNest.Reporting/NestPdfWriter.cs b/OpenNest.Reporting/NestPdfWriter.cs index bb9c2b37..edf5a0ab 100644 --- a/OpenNest.Reporting/NestPdfWriter.cs +++ b/OpenNest.Reporting/NestPdfWriter.cs @@ -532,7 +532,7 @@ public static class NestPdfWriter snapshot.Thickness > 0 ? $"{Number(snapshot.Thickness)} {snapshot.Units}" : "Not specified"; private static string SheetSize(NestReportSnapshot snapshot, ReportPlate plate) => - $"{Number(plate.Bounds.Length)} x {Number(plate.Bounds.Width)} {snapshot.Units}"; + $"{Number(plate.Bounds.Width)} x {Number(plate.Bounds.Length)} {snapshot.Units}"; private static string Number(double value) => value.ToString("0.####", Invariant); diff --git a/OpenNest.Tests/Reporting/NestPdfLayoutTests.cs b/OpenNest.Tests/Reporting/NestPdfLayoutTests.cs index fd428cfa..d3434f29 100644 --- a/OpenNest.Tests/Reporting/NestPdfLayoutTests.cs +++ b/OpenNest.Tests/Reporting/NestPdfLayoutTests.cs @@ -37,7 +37,7 @@ public sealed class NestPdfLayoutTests : IDisposable Assert.Matches(@"R002\s+Rotated\s+1\s+3\s+0\s+2\s+1, 3", summary); Assert.Matches(@"R003\s+Bracket\s+7\s+3\s+4\s+0\s+1, 3", summary); Assert.Matches(@"R004\s+Unplaced\s+3\s+0\s+3\s+0\s+-", summary); - Assert.Matches(@"3\s+60 x 30 in\s+1\s+2", summary); + Assert.Matches(@"3\s+30 x 60 in\s+1\s+2", summary); for (var plate = 1; plate <= 4; plate++) { var page = pages[plate]; @@ -143,7 +143,7 @@ public sealed class NestPdfLayoutTests : IDisposable Assert.Equal(5, pages.Length); Assert.Contains("millimeters (mm)", pages[0]); Assert.Contains("3 mm", pages[0]); - Assert.Matches(@"48 x 24 mm", pages[2]); + Assert.Matches(@"24 x 48 mm", pages[2]); using var pdf = PdfReader.Open(path, PdfDocumentOpenMode.Import); var stream = ReportPdf.ContentStreams(pdf.Pages[1]).Last(); stream = stream[(stream.IndexOf("W* n", StringComparison.Ordinal) + 4)..]; diff --git a/OpenNest.Tests/Reporting/NestPdfWriterTests.cs b/OpenNest.Tests/Reporting/NestPdfWriterTests.cs index 996e1d51..86fc995e 100644 --- a/OpenNest.Tests/Reporting/NestPdfWriterTests.cs +++ b/OpenNest.Tests/Reporting/NestPdfWriterTests.cs @@ -47,7 +47,7 @@ public sealed class NestPdfWriterTests : IDisposable Assert.Contains("2026-09-29 12:00 +00:00", summary); Assert.Matches(@"Distinct layouts:\s+1", summary); Assert.Matches(@"Total physical sheets:\s+2", summary); - Assert.Matches(@"1\s+48 x 24 in\s+2\s+4\s+\d+\.\d%", summary); + Assert.Matches(@"1\s+24 x 48 in\s+2\s+4\s+\d+\.\d%", summary); Assert.Matches(@"R001\s+Bracket\s+5\s+4\s+1\s+0\s+1", summary); Assert.Matches(@"R002\s+Rotated\s+1\s+2\s+0\s+1\s+1", summary); Assert.Matches(@"R003\s+Bracket\s+7\s+2\s+5\s+0\s+1", summary); diff --git a/docs/nest-reports.md b/docs/nest-reports.md index d19dbeb7..5a17f268 100644 --- a/docs/nest-reports.md +++ b/docs/nest-reports.md @@ -54,6 +54,8 @@ each plate's part table across pages with the heading row repeated, and notes flow as an ordinary paragraph. No row, table or note text is ever dropped or truncated to fit a page. +Stock sizes read **width x length** in job units. + Each part ID is centered on its part's pole of inaccessibility (`PolyLabel`, the same method `PlateView`'s `LayoutPart` uses), computed on a placement-independent quantized copy so identical parts always get the