From 79a3410bb98a5c1d9e4048e9f49a7c7dde478bcf Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Mon, 16 Mar 2026 20:46:47 -0400 Subject: [PATCH] feat(ui): position part labels at polylabel center Replace PathPoints[0] label positioning with polylabel algorithm to place part ID labels at the visual center of each part. Labels are now centered and readable even in dense nests. Co-Authored-By: Claude Opus 4.6 (1M context) --- OpenNest/LayoutPart.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenNest/LayoutPart.cs b/OpenNest/LayoutPart.cs index 1431ea2..adb4748 100644 --- a/OpenNest/LayoutPart.cs +++ b/OpenNest/LayoutPart.cs @@ -122,7 +122,9 @@ namespace OpenNest var entities = ConvertProgram.ToGeometry(BasePart.Program); var nonRapid = entities.Where(e => e.Layer != SpecialLayers.Rapid).ToList(); - if (nonRapid.Count == 0) + var shapes = ShapeBuilder.GetShapes(nonRapid); + + if (shapes.Count == 0) { var bbox = BasePart.Program.BoundingBox(); return new Vector(bbox.Location.X + bbox.Width / 2, bbox.Location.Y + bbox.Length / 2);