fix: correct Size width/length axis mapping throughout codebase
The Size fix (d4222db) changed Size.Width to Y axis and Size.Length to
X axis but only updated DrawPlate/LayoutViewGL. BoundingBox, WorkArea,
rotations, DXF export, and engine code still used the old Width=X
convention, causing the fill engine to get a swapped work area (60x120
instead of 120x60) and parts to fill in the wrong direction.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -8,8 +8,8 @@ namespace OpenNest.Engine.BestFit.Tiling
|
||||
{
|
||||
public TileResult Evaluate(BestFitResult bestFit, Plate plate)
|
||||
{
|
||||
var plateWidth = plate.Size.Width - plate.EdgeSpacing.Left - plate.EdgeSpacing.Right;
|
||||
var plateHeight = plate.Size.Length - plate.EdgeSpacing.Top - plate.EdgeSpacing.Bottom;
|
||||
var plateWidth = plate.Size.Length - plate.EdgeSpacing.Left - plate.EdgeSpacing.Right;
|
||||
var plateHeight = plate.Size.Width - plate.EdgeSpacing.Top - plate.EdgeSpacing.Bottom;
|
||||
|
||||
var result1 = TryTile(bestFit, plateWidth, plateHeight, false);
|
||||
var result2 = TryTile(bestFit, plateWidth, plateHeight, true);
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace OpenNest
|
||||
|
||||
// Top pair candidates — check if pairs tile better in this box.
|
||||
var bestFits = BestFitCache.GetOrCompute(
|
||||
drawing, Plate.Size.Width, Plate.Size.Length, Plate.PartSpacing);
|
||||
drawing, Plate.Size.Length, Plate.Size.Width, Plate.PartSpacing);
|
||||
var topPairs = bestFits.Where(r => r.Keep).Take(3);
|
||||
|
||||
foreach (var pair in topPairs)
|
||||
|
||||
@@ -30,11 +30,11 @@ namespace OpenNest
|
||||
IProgress<NestProgress> progress = null)
|
||||
{
|
||||
var bestFits = BestFitCache.GetOrCompute(
|
||||
item.Drawing, plateSize.Width, plateSize.Length, partSpacing);
|
||||
item.Drawing, plateSize.Length, plateSize.Width, partSpacing);
|
||||
|
||||
var candidates = SelectPairCandidates(bestFits, workArea);
|
||||
Debug.WriteLine($"[PairFiller] Total: {bestFits.Count}, Kept: {bestFits.Count(r => r.Keep)}, Trying: {candidates.Count}");
|
||||
Debug.WriteLine($"[PairFiller] Plate: {plateSize.Width:F2}x{plateSize.Length:F2}, WorkArea: {workArea.Width:F2}x{workArea.Length:F2}");
|
||||
Debug.WriteLine($"[PairFiller] Plate: {plateSize.Length:F2}x{plateSize.Width:F2}, WorkArea: {workArea.Width:F2}x{workArea.Length:F2}");
|
||||
|
||||
List<Part> best = null;
|
||||
var bestScore = default(FillScore);
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace OpenNest.Engine.Sequencing
|
||||
rows.Sort((a, b) => a.RowY.CompareTo(b.RowY));
|
||||
|
||||
// Determine initial direction based on exit point
|
||||
var leftToRight = exit.X > plate.Size.Width * 0.5;
|
||||
var leftToRight = exit.X > plate.Size.Length * 0.5;
|
||||
|
||||
var result = new List<SequencedPart>(parts.Count);
|
||||
foreach (var row in rows)
|
||||
|
||||
@@ -6,16 +6,16 @@ namespace OpenNest.Engine.Sequencing
|
||||
{
|
||||
public static Vector GetExitPoint(Plate plate)
|
||||
{
|
||||
var w = plate.Size.Width;
|
||||
var l = plate.Size.Length;
|
||||
var xExtent = plate.Size.Length;
|
||||
var yExtent = plate.Size.Width;
|
||||
|
||||
return plate.Quadrant switch
|
||||
{
|
||||
1 => new Vector(w, l),
|
||||
2 => new Vector(0, l),
|
||||
1 => new Vector(xExtent, yExtent),
|
||||
2 => new Vector(0, yExtent),
|
||||
3 => new Vector(0, 0),
|
||||
4 => new Vector(w, 0),
|
||||
_ => new Vector(w, l)
|
||||
4 => new Vector(xExtent, 0),
|
||||
_ => new Vector(xExtent, yExtent)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user