refactor: rename Size.Height to Size.Length across codebase

"Length" is more natural than "height" for flat plate materials.
Renames the field on OpenNest.Geometry.Size, Box.Height property,
and all references across 38 files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-12 22:01:40 -04:00
parent 7e0edd112a
commit 612b540d9d
38 changed files with 133 additions and 133 deletions

View File

@@ -135,7 +135,7 @@ if (!keepParts)
plate.Parts.Clear();
Console.WriteLine($"Nest: {nest.Name}");
Console.WriteLine($"Plate: {plateIndex} ({plate.Size.Width:F1} x {plate.Size.Height:F1}), spacing={plate.PartSpacing:F2}");
Console.WriteLine($"Plate: {plateIndex} ({plate.Size.Width:F1} x {plate.Size.Length:F1}), spacing={plate.PartSpacing:F2}");
Console.WriteLine($"Drawing: {drawing.Name}");
if (!keepParts)

View File

@@ -388,7 +388,7 @@ namespace OpenNest.Geometry
boundingBox.X = minX;
boundingBox.Y = minY;
boundingBox.Width = maxX - minX;
boundingBox.Height = maxY - minY;
boundingBox.Length = maxY - minY;
}
public override Entity OffsetEntity(double distance, OffsetSide side)

View File

@@ -13,7 +13,7 @@ namespace OpenNest.Geometry
double minX = boxes[0].X;
double minY = boxes[0].Y;
double maxX = boxes[0].X + boxes[0].Width;
double maxY = boxes[0].Y + boxes[0].Height;
double maxY = boxes[0].Y + boxes[0].Length;
foreach (var box in boxes)
{

View File

@@ -15,14 +15,14 @@ namespace OpenNest.Geometry
{
Location = new Vector(x, y);
Width = w;
Height = h;
Length = h;
}
public Vector Location;
public Vector Center
{
get { return new Vector(X + Width * 0.5, Y + Height * 0.5); }
get { return new Vector(X + Width * 0.5, Y + Length * 0.5); }
}
public Size Size;
@@ -45,10 +45,10 @@ namespace OpenNest.Geometry
set { Size.Width = value; }
}
public double Height
public double Length
{
get { return Size.Height; }
set { Size.Height = value; }
get { return Size.Length; }
set { Size.Length = value; }
}
public void MoveTo(double x, double y)
@@ -86,7 +86,7 @@ namespace OpenNest.Geometry
public double Top
{
get { return Y + Height; }
get { return Y + Length; }
}
public double Bottom
@@ -96,12 +96,12 @@ namespace OpenNest.Geometry
public double Area()
{
return Width * Height;
return Width * Length;
}
public double Perimeter()
{
return Width * 2 + Height * 2;
return Width * 2 + Length * 2;
}
public bool Intersects(Box box)
@@ -197,12 +197,12 @@ namespace OpenNest.Geometry
public Box Offset(double d)
{
return new Box(X - d, Y - d, Width + d * 2, Height + d * 2);
return new Box(X - d, Y - d, Width + d * 2, Length + d * 2);
}
public override string ToString()
{
return string.Format("[Box: X={0}, Y={1}, Width={2}, Height={3}]", X, Y, Width, Height);
return string.Format("[Box: X={0}, Y={1}, Width={2}, Length={3}]", X, Y, Width, Length);
}
}
}

View File

@@ -23,7 +23,7 @@
var x = large.Left;
var y = large.Bottom;
var w = small.Left - x;
var h = large.Height;
var h = large.Length;
return new Box(x, y, w, h);
}
@@ -49,7 +49,7 @@
var x = small.Right;
var y = large.Bottom;
var w = large.Right - x;
var h = large.Height;
var h = large.Length;
return new Box(x, y, w, h);
}

View File

@@ -263,7 +263,7 @@ namespace OpenNest.Geometry
boundingBox.X = Center.X - Radius;
boundingBox.Y = Center.Y - Radius;
boundingBox.Width = Diameter;
boundingBox.Height = Diameter;
boundingBox.Length = Diameter;
}
public override Entity OffsetEntity(double distance, OffsetSide side)

View File

@@ -381,12 +381,12 @@ namespace OpenNest.Geometry
if (StartPoint.Y < EndPoint.Y)
{
boundingBox.Y = StartPoint.Y;
boundingBox.Height = EndPoint.Y - StartPoint.Y;
boundingBox.Length = EndPoint.Y - StartPoint.Y;
}
else
{
boundingBox.Y = EndPoint.Y;
boundingBox.Height = StartPoint.Y - EndPoint.Y;
boundingBox.Length = StartPoint.Y - EndPoint.Y;
}
}

View File

@@ -312,7 +312,7 @@ namespace OpenNest.Geometry
boundingBox.X = minX;
boundingBox.Y = minY;
boundingBox.Width = maxX - minX;
boundingBox.Height = maxY - minY;
boundingBox.Length = maxY - minY;
}
public override Entity OffsetEntity(double distance, OffsetSide side)

View File

@@ -1,16 +1,16 @@
using System;
using System;
namespace OpenNest.Geometry
{
public struct Size
{
public Size(double width, double height)
public Size(double width, double length)
{
Height = height;
Length = length;
Width = width;
}
public double Height;
public double Length;
public double Width;
@@ -21,10 +21,10 @@ namespace OpenNest.Geometry
if (a.Length > 2)
throw new FormatException("Invalid size format.");
var height = double.Parse(a[0]);
var length = double.Parse(a[0]);
var width = double.Parse(a[1]);
return new Size(width, height);
return new Size(width, length);
}
public static bool TryParse(string s, out Size size)
@@ -44,12 +44,12 @@ namespace OpenNest.Geometry
public override string ToString()
{
return string.Format("{0} x {1}", Height, Width);
return string.Format("{0} x {1}", Length, Width);
}
public string ToString(int decimalPlaces)
{
return string.Format("{0} x {1}", System.Math.Round(Height, decimalPlaces), System.Math.Round(Width, decimalPlaces));
return string.Format("{0} x {1}", System.Math.Round(Length, decimalPlaces), System.Math.Round(Width, decimalPlaces));
}
}
}

View File

@@ -220,7 +220,7 @@ namespace OpenNest
var part = new Part(BaseDrawing, clonedProgram,
location + offset,
new Box(BoundingBox.X + offset.X, BoundingBox.Y + offset.Y,
BoundingBox.Width, BoundingBox.Height));
BoundingBox.Width, BoundingBox.Length));
return part;
}

View File

@@ -117,7 +117,7 @@ namespace OpenNest
{
const double oneAndHalfPI = System.Math.PI * 1.5;
Size = new Size(Size.Height, Size.Width);
Size = new Size(Size.Length, Size.Width);
if (rotationDirection == RotationType.CW)
{
@@ -128,7 +128,7 @@ namespace OpenNest
switch (Quadrant)
{
case 1:
Offset(0, Size.Height);
Offset(0, Size.Length);
break;
case 2:
@@ -136,7 +136,7 @@ namespace OpenNest
break;
case 3:
Offset(0, -Size.Height);
Offset(0, -Size.Length);
break;
case 4:
@@ -165,7 +165,7 @@ namespace OpenNest
break;
case 2:
Offset(0, Size.Height);
Offset(0, Size.Length);
break;
case 3:
@@ -173,7 +173,7 @@ namespace OpenNest
break;
case 4:
Offset(0, -Size.Height);
Offset(0, -Size.Length);
break;
default:
@@ -200,19 +200,19 @@ namespace OpenNest
switch (Quadrant)
{
case 1:
centerpt = new Vector(Size.Width * 0.5, Size.Height * 0.5);
centerpt = new Vector(Size.Width * 0.5, Size.Length * 0.5);
break;
case 2:
centerpt = new Vector(-Size.Width * 0.5, Size.Height * 0.5);
centerpt = new Vector(-Size.Width * 0.5, Size.Length * 0.5);
break;
case 3:
centerpt = new Vector(-Size.Width * 0.5, -Size.Height * 0.5);
centerpt = new Vector(-Size.Width * 0.5, -Size.Length * 0.5);
break;
case 4:
centerpt = new Vector(Size.Width * 0.5, -Size.Height * 0.5);
centerpt = new Vector(Size.Width * 0.5, -Size.Length * 0.5);
break;
default:
@@ -308,12 +308,12 @@ namespace OpenNest
case 3:
plateBox.X = (float)-Size.Width;
plateBox.Y = (float)-Size.Height;
plateBox.Y = (float)-Size.Length;
break;
case 4:
plateBox.X = 0;
plateBox.Y = (float)-Size.Height;
plateBox.Y = (float)-Size.Length;
break;
default:
@@ -321,7 +321,7 @@ namespace OpenNest
}
plateBox.Width = Size.Width;
plateBox.Height = Size.Height;
plateBox.Length = Size.Length;
if (!includeParts)
return plateBox;
@@ -341,7 +341,7 @@ namespace OpenNest
? partsBox.Right - boundingBox.X
: plateBox.Right - boundingBox.X;
boundingBox.Height = partsBox.Top > plateBox.Top
boundingBox.Length = partsBox.Top > plateBox.Top
? partsBox.Top - boundingBox.Y
: plateBox.Top - boundingBox.Y;
@@ -359,7 +359,7 @@ namespace OpenNest
box.X += EdgeSpacing.Left;
box.Y += EdgeSpacing.Bottom;
box.Width -= EdgeSpacing.Left + EdgeSpacing.Right;
box.Height -= EdgeSpacing.Top + EdgeSpacing.Bottom;
box.Length -= EdgeSpacing.Top + EdgeSpacing.Bottom;
return box;
}
@@ -383,28 +383,28 @@ namespace OpenNest
var bounds = Parts.GetBoundingBox();
double width;
double height;
double length;
switch (Quadrant)
{
case 1:
width = System.Math.Abs(bounds.Right) + EdgeSpacing.Right;
height = System.Math.Abs(bounds.Top) + EdgeSpacing.Top;
length = System.Math.Abs(bounds.Top) + EdgeSpacing.Top;
break;
case 2:
width = System.Math.Abs(bounds.Left) + EdgeSpacing.Left;
height = System.Math.Abs(bounds.Top) + EdgeSpacing.Top;
length = System.Math.Abs(bounds.Top) + EdgeSpacing.Top;
break;
case 3:
width = System.Math.Abs(bounds.Left) + EdgeSpacing.Left;
height = System.Math.Abs(bounds.Bottom) + EdgeSpacing.Bottom;
length = System.Math.Abs(bounds.Bottom) + EdgeSpacing.Bottom;
break;
case 4:
width = System.Math.Abs(bounds.Right) + EdgeSpacing.Right;
height = System.Math.Abs(bounds.Bottom) + EdgeSpacing.Bottom;
length = System.Math.Abs(bounds.Bottom) + EdgeSpacing.Bottom;
break;
default:
@@ -413,7 +413,7 @@ namespace OpenNest
Size = new Size(
Helper.RoundUpToNearest(width, roundingFactor),
Helper.RoundUpToNearest(height, roundingFactor));
Helper.RoundUpToNearest(length, roundingFactor));
}
/// <summary>
@@ -422,7 +422,7 @@ namespace OpenNest
/// <returns></returns>
public double Area()
{
return Size.Width * Size.Height;
return Size.Width * Size.Length;
}
/// <summary>
@@ -503,7 +503,7 @@ namespace OpenNest
if (maxRight < work.Right)
{
var strip = new Box(maxRight, work.Bottom, work.Right - maxRight, work.Height);
var strip = new Box(maxRight, work.Bottom, work.Right - maxRight, work.Length);
if (strip.Area() > 1.0)
results.Add(strip);
}
@@ -548,7 +548,7 @@ namespace OpenNest
if (minLeft > work.Left)
{
var strip = new Box(work.Left, work.Bottom, minLeft - work.Left, work.Height);
var strip = new Box(work.Left, work.Bottom, minLeft - work.Left, work.Length);
if (strip.Area() > 1.0)
results.Add(strip);
}

View File

@@ -57,7 +57,7 @@ namespace OpenNest.Engine.BestFit
var combinedBox = ((IEnumerable<IBoundable>)new IBoundable[] { part1, part2 }).GetBoundingBox();
bestArea = combinedBox.Area();
bestWidth = combinedBox.Width;
bestHeight = combinedBox.Height;
bestHeight = combinedBox.Length;
bestRotation = 0;
}

View File

@@ -64,15 +64,15 @@ namespace OpenNest.Engine.BestFit
if (isHorizontalPush)
{
perpMin = -(bbox2.Height + spacing);
perpMax = bbox1.Height + bbox2.Height + spacing;
perpMin = -(bbox2.Length + spacing);
perpMax = bbox1.Length + bbox2.Length + spacing;
pushStartOffset = bbox1.Width + bbox2.Width + spacing * 2;
}
else
{
perpMin = -(bbox2.Width + spacing);
perpMax = bbox1.Width + bbox2.Width + spacing;
pushStartOffset = bbox1.Height + bbox2.Height + spacing * 2;
pushStartOffset = bbox1.Length + bbox2.Length + spacing * 2;
}
// Pre-compute part1's offset lines (half-spacing outward)

View File

@@ -9,7 +9,7 @@ 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.Height - plate.EdgeSpacing.Top - plate.EdgeSpacing.Bottom;
var plateHeight = plate.Size.Length - plate.EdgeSpacing.Top - plate.EdgeSpacing.Bottom;
var result1 = TryTile(bestFit, plateWidth, plateHeight, false);
var result2 = TryTile(bestFit, plateWidth, plateHeight, true);

View File

@@ -17,10 +17,10 @@ namespace OpenNest.CirclePacking
Bin.Right - item.BoundingBox.Right + Tolerance.Epsilon,
Bin.Top - item.BoundingBox.Top + Tolerance.Epsilon);
var rows = System.Math.Floor((Bin.Height + Tolerance.Epsilon) / (item.Diameter));
var rows = System.Math.Floor((Bin.Length + Tolerance.Epsilon) / (item.Diameter));
var diameter = item.Diameter;
var remaining = Bin.Height - diameter * rows;
var remaining = Bin.Length - diameter * rows;
var radius = diameter * 0.5;
if (remaining < radius)
@@ -47,7 +47,7 @@ namespace OpenNest.CirclePacking
}
else
{
var yoffset = (Bin.Height - diameter) / (2 * rows - 1);
var yoffset = (Bin.Length - diameter) / (2 * rows - 1);
var xoffset = Trigonometry.Base(yoffset, diameter);
var yodd = Bin.Y + yoffset;

View File

@@ -71,12 +71,12 @@ namespace OpenNest.CirclePacking
Bin.Right - item.BoundingBox.Right + Tolerance.Epsilon,
Bin.Top - item.BoundingBox.Top + Tolerance.Epsilon);
var count = System.Math.Floor((bin.Height + Tolerance.Epsilon) / item.Diameter);
var count = System.Math.Floor((bin.Length + Tolerance.Epsilon) / item.Diameter);
if (count == 0)
return bin;
var yoffset = (bin.Height - item.Diameter) / (count - 1);
var yoffset = (bin.Length - item.Diameter) / (count - 1);
var xoffset = Trigonometry.Base(yoffset * 0.5, item.Diameter);
int column = 0;

View File

@@ -9,7 +9,7 @@ namespace OpenNest
public FillLinear(Box workArea, double partSpacing)
{
PartSpacing = partSpacing;
WorkArea = new Box(workArea.X, workArea.Y, workArea.Width, workArea.Height);
WorkArea = new Box(workArea.X, workArea.Y, workArea.Width, workArea.Length);
}
public Box WorkArea { get; }
@@ -34,7 +34,7 @@ namespace OpenNest
private static double GetDimension(Box box, NestDirection direction)
{
return direction == NestDirection.Horizontal ? box.Width : box.Height;
return direction == NestDirection.Horizontal ? box.Width : box.Length;
}
private static double GetStart(Box box, NestDirection direction)
@@ -321,7 +321,7 @@ namespace OpenNest
template.Offset(WorkArea.Location - template.BoundingBox.Location);
if (template.BoundingBox.Width > WorkArea.Width + Tolerance.Epsilon ||
template.BoundingBox.Height > WorkArea.Height + Tolerance.Epsilon)
template.BoundingBox.Length > WorkArea.Length + Tolerance.Epsilon)
return pattern;
pattern.Parts.Add(template);
@@ -472,7 +472,7 @@ namespace OpenNest
if (width <= Tolerance.Epsilon)
return new List<Part>();
remainingStrip = new Box(left, WorkArea.Y, width, WorkArea.Height);
remainingStrip = new Box(left, WorkArea.Y, width, WorkArea.Length);
}
// Build rotation set: always try cardinal orientations (0° and 90°),
@@ -601,7 +601,7 @@ namespace OpenNest
var basePattern = pattern.Clone(offset);
if (basePattern.BoundingBox.Width > WorkArea.Width + Tolerance.Epsilon ||
basePattern.BoundingBox.Height > WorkArea.Height + Tolerance.Epsilon)
basePattern.BoundingBox.Length > WorkArea.Length + Tolerance.Epsilon)
return new List<Part>();
return FillRecursive(basePattern, primaryAxis, depth: 0);

View File

@@ -80,7 +80,7 @@ namespace OpenNest
if (maxRight < workArea.Right)
{
var width = workArea.Right - maxRight;
var height = workArea.Height;
var height = workArea.Length;
if (System.Math.Min(width, height) >= MinRemnantDimension)
largest = System.Math.Max(largest, width * height);

View File

@@ -70,8 +70,8 @@ namespace OpenNest
testPart.UpdateBounds();
var partLongestSide = System.Math.Max(testPart.BoundingBox.Width, testPart.BoundingBox.Height);
var workAreaShortSide = System.Math.Min(workArea.Width, workArea.Height);
var partLongestSide = System.Math.Max(testPart.BoundingBox.Width, testPart.BoundingBox.Length);
var workAreaShortSide = System.Math.Min(workArea.Width, workArea.Length);
if (workAreaShortSide < partLongestSide)
{
@@ -113,7 +113,7 @@ namespace OpenNest
}
var bestLinearScore = best != null ? FillScore.Compute(best, workArea) : default;
Debug.WriteLine($"[FindBestFill] Linear: {bestLinearScore.Count} parts, density={bestLinearScore.Density:P1} | WorkArea: {workArea.Width:F1}x{workArea.Height:F1} | Angles: {angles.Count}");
Debug.WriteLine($"[FindBestFill] Linear: {bestLinearScore.Count} parts, density={bestLinearScore.Density:P1} | WorkArea: {workArea.Width:F1}x{workArea.Length:F1} | Angles: {angles.Count}");
// Try rectangle best-fit (mixes orientations to fill remnant strips).
var rectResult = FillRectangleBestFit(item, workArea);
@@ -143,7 +143,7 @@ namespace OpenNest
var angles = RotationAnalysis.FindHullEdgeAngles(groupParts);
var best = FillPattern(engine, groupParts, angles, workArea);
Debug.WriteLine($"[Fill(groupParts,Box)] Linear: {best?.Count ?? 0} parts | WorkArea: {workArea.Width:F1}x{workArea.Height:F1}");
Debug.WriteLine($"[Fill(groupParts,Box)] Linear: {best?.Count ?? 0} parts | WorkArea: {workArea.Width:F1}x{workArea.Length:F1}");
if (groupParts.Count == 1)
{
@@ -213,7 +213,7 @@ namespace OpenNest
private List<Part> FillWithPairs(NestItem item, Box workArea)
{
var bestFits = BestFitCache.GetOrCompute(
item.Drawing, Plate.Size.Width, Plate.Size.Height,
item.Drawing, Plate.Size.Width, Plate.Size.Length,
Plate.PartSpacing);
var candidates = SelectPairCandidates(bestFits, workArea);
@@ -260,8 +260,8 @@ namespace OpenNest
var kept = bestFits.Where(r => r.Keep).ToList();
var top = kept.Take(50).ToList();
var workShortSide = System.Math.Min(workArea.Width, workArea.Height);
var plateShortSide = System.Math.Min(Plate.Size.Width, Plate.Size.Height);
var workShortSide = System.Math.Min(workArea.Width, workArea.Length);
var plateShortSide = System.Math.Min(Plate.Size.Width, Plate.Size.Length);
// When the work area is significantly narrower than the plate,
// include all pairs that fit the narrow dimension.
@@ -356,7 +356,7 @@ namespace OpenNest
var refDim = horizontal
? sorted.Max(p => p.BoundingBox.Width)
: sorted.Max(p => p.BoundingBox.Height);
: sorted.Max(p => p.BoundingBox.Length);
var gapThreshold = refDim * 0.5;
var clusters = new List<List<Part>>();
@@ -425,7 +425,7 @@ namespace OpenNest
if (stripWidth <= 0)
return null;
stripBox = new Box(stripLeft, workArea.Y, stripWidth, workArea.Height);
stripBox = new Box(stripLeft, workArea.Y, stripWidth, workArea.Length);
}
else
{
@@ -438,7 +438,7 @@ namespace OpenNest
stripBox = new Box(workArea.X, stripBottom, workArea.Width, stripHeight);
}
Debug.WriteLine($"[TryStripRefill] Strip: {stripBox.Width:F1}x{stripBox.Height:F1} at ({stripBox.X:F1},{stripBox.Y:F1})");
Debug.WriteLine($"[TryStripRefill] Strip: {stripBox.Width:F1}x{stripBox.Length:F1} at ({stripBox.X:F1},{stripBox.Y:F1})");
var stripParts = FindBestFill(item, stripBox);

View File

@@ -15,7 +15,7 @@ namespace OpenNest.RectanglePacking
};
bin.Width += partSpacing;
bin.Height += partSpacing;
bin.Length += partSpacing;
return bin;
}
@@ -25,7 +25,7 @@ namespace OpenNest.RectanglePacking
var box = item.Drawing.Program.BoundingBox();
box.Width += partSpacing;
box.Height += partSpacing;
box.Length += partSpacing;
return new Item
{

View File

@@ -44,11 +44,11 @@ namespace OpenNest.RectanglePacking
int normalColumns = 0;
int rotateColumns = 0;
if (!BestCombination.FindFrom2(item.Width, item.Height, bin.Width, out normalColumns, out rotateColumns))
if (!BestCombination.FindFrom2(item.Width, item.Length, bin.Width, out normalColumns, out rotateColumns))
return bin;
var normalRows = (int)System.Math.Floor((bin.Height + Tolerance.Epsilon) / item.Height);
var rotateRows = (int)System.Math.Floor((bin.Height + Tolerance.Epsilon) / item.Width);
var normalRows = (int)System.Math.Floor((bin.Length + Tolerance.Epsilon) / item.Length);
var rotateRows = (int)System.Math.Floor((bin.Length + Tolerance.Epsilon) / item.Width);
item.Location = bin.Location;
@@ -69,17 +69,17 @@ namespace OpenNest.RectanglePacking
int normalRows = 0;
int rotateRows = 0;
if (!BestCombination.FindFrom2(item.Height, item.Width, Bin.Height, out normalRows, out rotateRows))
if (!BestCombination.FindFrom2(item.Length, item.Width, Bin.Length, out normalRows, out rotateRows))
return bin;
var normalColumns = (int)System.Math.Floor((Bin.Width + Tolerance.Epsilon) / item.Width);
var rotateColumns = (int)System.Math.Floor((Bin.Width + Tolerance.Epsilon) / item.Height);
var rotateColumns = (int)System.Math.Floor((Bin.Width + Tolerance.Epsilon) / item.Length);
item.Location = bin.Location;
bin.Items.AddRange(FillGrid(item, normalRows, normalColumns, int.MaxValue));
item.Location.Y += item.Height * normalRows;
item.Location.Y += item.Length * normalRows;
item.Rotate();
bin.Items.AddRange(FillGrid(item, rotateRows, rotateColumns, int.MaxValue));

View File

@@ -28,7 +28,7 @@ namespace OpenNest.RectanglePacking
for (var j = 0; j < innerCount; j++)
{
var x = (columnMajor ? i : j) * item.Width + item.X;
var y = (columnMajor ? j : i) * item.Height + item.Y;
var y = (columnMajor ? j : i) * item.Length + item.Y;
var clone = item.Clone() as Item;
clone.Location = new Vector(x, y);

View File

@@ -15,7 +15,7 @@ namespace OpenNest.RectanglePacking
public override void Fill(Item item)
{
var ycount = (int)System.Math.Floor((Bin.Height + Tolerance.Epsilon) / item.Height);
var ycount = (int)System.Math.Floor((Bin.Length + Tolerance.Epsilon) / item.Length);
var xcount = (int)System.Math.Floor((Bin.Width + Tolerance.Epsilon) / item.Width);
for (int i = 0; i < xcount; i++)
@@ -24,7 +24,7 @@ namespace OpenNest.RectanglePacking
for (int j = 0; j < ycount; j++)
{
var y = item.Height * j + Bin.Y;
var y = item.Length * j + Bin.Y;
var addedItem = item.Clone() as Item;
addedItem.Location = new Vector(x, y);
@@ -36,7 +36,7 @@ namespace OpenNest.RectanglePacking
public override void Fill(Item item, int maxCount)
{
var ycount = (int)System.Math.Floor((Bin.Height + Tolerance.Epsilon) / item.Height);
var ycount = (int)System.Math.Floor((Bin.Length + Tolerance.Epsilon) / item.Length);
var xcount = (int)System.Math.Floor((Bin.Width + Tolerance.Epsilon) / item.Width);
var count = ycount * xcount;
@@ -60,7 +60,7 @@ namespace OpenNest.RectanglePacking
columns = (int)System.Math.Ceiling((double)maxCount / rows);
}
Bin.Items.AddRange(FillGrid(item, rows, columns, maxCount, columnMajor: item.Width > item.Height));
Bin.Items.AddRange(FillGrid(item, rows, columns, maxCount, columnMajor: item.Width > item.Length));
}
}
}

View File

@@ -12,7 +12,7 @@ namespace OpenNest.RectanglePacking
public void Rotate()
{
Generic.Swap(ref Size.Width, ref Size.Height);
Generic.Swap(ref Size.Width, ref Size.Length);
IsRotated = !IsRotated;
}
@@ -38,7 +38,7 @@ namespace OpenNest.RectanglePacking
double minX = items[0].X;
double minY = items[0].Y;
double maxX = items[0].X + items[0].Width;
double maxY = items[0].Y + items[0].Height;
double maxY = items[0].Y + items[0].Length;
foreach (var box in items)
{

View File

@@ -16,11 +16,11 @@ namespace OpenNest.RectanglePacking
public override void Pack(List<Item> items)
{
items = items.OrderBy(i => -i.Height).ToList();
items = items.OrderBy(i => -i.Length).ToList();
foreach (var item in items)
{
if (item.Height > Bin.Height)
if (item.Length > Bin.Length)
continue;
var level = FindLevel(item);
@@ -36,7 +36,7 @@ namespace OpenNest.RectanglePacking
{
foreach (var level in levels)
{
if (level.Height < item.Height)
if (level.Height < item.Length)
continue;
if (level.RemainingWidth < item.Width)
@@ -58,12 +58,12 @@ namespace OpenNest.RectanglePacking
var remaining = Bin.Top - y;
if (remaining < item.Height)
if (remaining < item.Length)
return null;
var level = new Level(Bin);
level.Y = y;
level.Height = item.Height;
level.Height = item.Length;
levels.Add(level);

View File

@@ -145,29 +145,29 @@ namespace OpenNest.IO
{
case 1:
pt1 = new XYZ(0, 0, 0);
pt2 = new XYZ(0, plate.Size.Height, 0);
pt3 = new XYZ(plate.Size.Width, plate.Size.Height, 0);
pt2 = new XYZ(0, plate.Size.Length, 0);
pt3 = new XYZ(plate.Size.Width, plate.Size.Length, 0);
pt4 = new XYZ(plate.Size.Width, 0, 0);
break;
case 2:
pt1 = new XYZ(0, 0, 0);
pt2 = new XYZ(0, plate.Size.Height, 0);
pt3 = new XYZ(-plate.Size.Width, plate.Size.Height, 0);
pt2 = new XYZ(0, plate.Size.Length, 0);
pt3 = new XYZ(-plate.Size.Width, plate.Size.Length, 0);
pt4 = new XYZ(-plate.Size.Width, 0, 0);
break;
case 3:
pt1 = new XYZ(0, 0, 0);
pt2 = new XYZ(0, -plate.Size.Height, 0);
pt3 = new XYZ(-plate.Size.Width, -plate.Size.Height, 0);
pt2 = new XYZ(0, -plate.Size.Length, 0);
pt3 = new XYZ(-plate.Size.Width, -plate.Size.Length, 0);
pt4 = new XYZ(-plate.Size.Width, 0, 0);
break;
case 4:
pt1 = new XYZ(0, 0, 0);
pt2 = new XYZ(0, -plate.Size.Height, 0);
pt3 = new XYZ(plate.Size.Width, -plate.Size.Height, 0);
pt2 = new XYZ(0, -plate.Size.Length, 0);
pt3 = new XYZ(plate.Size.Width, -plate.Size.Length, 0);
pt4 = new XYZ(plate.Size.Width, 0, 0);
break;

View File

@@ -82,7 +82,7 @@ namespace OpenNest.IO
var pd = nest.PlateDefaults;
return new PlateDefaultsDto
{
Size = new SizeDto { Width = pd.Size.Width, Length = pd.Size.Height },
Size = new SizeDto { Width = pd.Size.Width, Length = pd.Size.Length },
Thickness = pd.Thickness,
Quadrant = pd.Quadrant,
PartSpacing = pd.PartSpacing,
@@ -161,7 +161,7 @@ namespace OpenNest.IO
list.Add(new PlateDto
{
Id = i + 1,
Size = new SizeDto { Width = plate.Size.Width, Length = plate.Size.Height },
Size = new SizeDto { Width = plate.Size.Width, Length = plate.Size.Length },
Thickness = plate.Thickness,
Quadrant = plate.Quadrant,
Quantity = plate.Quantity,

View File

@@ -40,10 +40,10 @@ namespace OpenNest.Mcp.Tools
{
var plate = nest.Plates[i];
var work = plate.WorkArea();
sb.AppendLine($" Plate {i}: {plate.Size.Width:F1} x {plate.Size.Height:F1}, " +
sb.AppendLine($" Plate {i}: {plate.Size.Width:F1} x {plate.Size.Length:F1}, " +
$"parts={plate.Parts.Count}, " +
$"utilization={plate.Utilization():P1}, " +
$"work area={work.Width:F1} x {work.Height:F1}");
$"work area={work.Width:F1} x {work.Length:F1}");
}
sb.AppendLine($"Drawings: {nest.Drawings.Count}");
@@ -51,7 +51,7 @@ namespace OpenNest.Mcp.Tools
foreach (var dwg in nest.Drawings)
{
var bbox = dwg.Program.BoundingBox();
sb.AppendLine($" {dwg.Name}: bbox={bbox.Width:F2} x {bbox.Height:F2}, " +
sb.AppendLine($" {dwg.Name}: bbox={bbox.Width:F2} x {bbox.Length:F2}, " +
$"required={dwg.Quantity.Required}, nested={dwg.Quantity.Nested}");
}
@@ -85,7 +85,7 @@ namespace OpenNest.Mcp.Tools
_session.Drawings.Add(drawing);
var bbox = pgm.BoundingBox();
return $"Imported drawing '{drawingName}': bbox={bbox.Width:F2} x {bbox.Height:F2}";
return $"Imported drawing '{drawingName}': bbox={bbox.Width:F2} x {bbox.Length:F2}";
}
[McpServerTool(Name = "create_drawing")]
@@ -134,7 +134,7 @@ namespace OpenNest.Mcp.Tools
_session.Drawings.Add(drawing);
var bbox = pgm.BoundingBox();
return $"Created drawing '{name}': bbox={bbox.Width:F2} x {bbox.Height:F2}";
return $"Created drawing '{name}': bbox={bbox.Width:F2} x {bbox.Length:F2}";
}
private static CncProgram CreateRectangle(double width, double height)

View File

@@ -32,13 +32,13 @@ namespace OpenNest.Mcp.Tools
var sb = new StringBuilder();
sb.AppendLine($"Plate {plateIndex}:");
sb.AppendLine($" Size: {plate.Size.Width:F1} x {plate.Size.Height:F1}");
sb.AppendLine($" Size: {plate.Size.Width:F1} x {plate.Size.Length:F1}");
sb.AppendLine($" Quadrant: {plate.Quadrant}");
sb.AppendLine($" Thickness: {plate.Thickness:F2}");
sb.AppendLine($" Material: {plate.Material.Name}");
sb.AppendLine($" Part spacing: {plate.PartSpacing:F2}");
sb.AppendLine($" Edge spacing: L={plate.EdgeSpacing.Left:F2} B={plate.EdgeSpacing.Bottom:F2} R={plate.EdgeSpacing.Right:F2} T={plate.EdgeSpacing.Top:F2}");
sb.AppendLine($" Work area: {work.X:F1},{work.Y:F1} {work.Width:F1}x{work.Height:F1}");
sb.AppendLine($" Work area: {work.X:F1},{work.Y:F1} {work.Width:F1}x{work.Length:F1}");
sb.AppendLine($" Parts: {plate.Parts.Count}");
sb.AppendLine($" Utilization: {plate.Utilization():P1}");
sb.AppendLine($" Quantity: {plate.Quantity}");
@@ -57,7 +57,7 @@ namespace OpenNest.Mcp.Tools
for (var i = 0; i < remnants.Count; i++)
{
var r = remnants[i];
sb.AppendLine($" Remnant {i}: ({r.X:F1},{r.Y:F1}) {r.Width:F1}x{r.Height:F1}, area={r.Area():F1}");
sb.AppendLine($" Remnant {i}: ({r.X:F1},{r.Y:F1}) {r.Width:F1}x{r.Length:F1}, area={r.Area():F1}");
}
return sb.ToString();
@@ -90,7 +90,7 @@ namespace OpenNest.Mcp.Tools
sb.AppendLine($" [{i}] {part.BaseDrawing.Name}: " +
$"loc=({part.Location.X:F2},{part.Location.Y:F2}), " +
$"rot={rotDeg:F1} deg, " +
$"bbox=({bbox.X:F2},{bbox.Y:F2} {bbox.Width:F2}x{bbox.Height:F2})");
$"bbox=({bbox.X:F2},{bbox.Y:F2} {bbox.Width:F2}x{bbox.Length:F2})");
}
if (plate.Parts.Count > limit)

View File

@@ -121,7 +121,7 @@ namespace OpenNest.Mcp.Tools
var added = plate.Parts.Count - countBefore;
totalAdded += added;
sb.AppendLine($" Remnant {i}: ({remnant.X:F1},{remnant.Y:F1} {remnant.Width:F1}x{remnant.Height:F1}) -> {added} parts {(success ? "" : "(no fit)")}");
sb.AppendLine($" Remnant {i}: ({remnant.X:F1},{remnant.Y:F1} {remnant.Width:F1}x{remnant.Length:F1}) -> {added} parts {(success ? "" : "(no fit)")}");
}
sb.AppendLine($"Total parts added: {totalAdded}");

View File

@@ -41,11 +41,11 @@ namespace OpenNest.Mcp.Tools
var work = plate.WorkArea();
var sb = new StringBuilder();
sb.AppendLine($"Created plate {index}: {plate.Size.Width:F1} x {plate.Size.Height:F1}");
sb.AppendLine($"Created plate {index}: {plate.Size.Width:F1} x {plate.Size.Length:F1}");
sb.AppendLine($" Quadrant: {plate.Quadrant}");
sb.AppendLine($" Part spacing: {plate.PartSpacing:F2}");
sb.AppendLine($" Edge spacing: L={plate.EdgeSpacing.Left:F2} B={plate.EdgeSpacing.Bottom:F2} R={plate.EdgeSpacing.Right:F2} T={plate.EdgeSpacing.Top:F2}");
sb.AppendLine($" Work area: {work.Width:F1} x {work.Height:F1}");
sb.AppendLine($" Work area: {work.Width:F1} x {work.Length:F1}");
return sb.ToString();
}

View File

@@ -95,7 +95,7 @@ namespace OpenNest.Actions
var location = plateView.PointWorldToGraph(SelectedArea.Location);
var size = new SizeF(
plateView.LengthWorldToGui(SelectedArea.Width),
plateView.LengthWorldToGui(SelectedArea.Height));
plateView.LengthWorldToGui(SelectedArea.Length));
var rect = new System.Drawing.RectangleF(location.X, location.Y - size.Height, size.Width, size.Height);

View File

@@ -205,7 +205,7 @@ namespace OpenNest.Controls
public virtual void ZoomToArea(Box box, bool redraw = true)
{
ZoomToArea(box.X, box.Y, box.Width, box.Height, redraw);
ZoomToArea(box.X, box.Y, box.Width, box.Length, redraw);
}
public virtual void ZoomToArea(double x, double y, double width, double height, bool redraw = true)

View File

@@ -384,13 +384,13 @@ namespace OpenNest.Controls
var plateRect = new RectangleF
{
Width = LengthWorldToGui(Plate.Size.Width),
Height = LengthWorldToGui(Plate.Size.Height)
Height = LengthWorldToGui(Plate.Size.Length)
};
var edgeSpacingRect = new RectangleF
{
Width = LengthWorldToGui(Plate.Size.Width - Plate.EdgeSpacing.Left - Plate.EdgeSpacing.Right),
Height = LengthWorldToGui(Plate.Size.Height - Plate.EdgeSpacing.Top - Plate.EdgeSpacing.Bottom)
Height = LengthWorldToGui(Plate.Size.Length - Plate.EdgeSpacing.Top - Plate.EdgeSpacing.Bottom)
};
switch (Plate.Quadrant)
@@ -410,17 +410,17 @@ namespace OpenNest.Controls
break;
case 3:
plateRect.Location = PointWorldToGraph(-Plate.Size.Width, -Plate.Size.Height);
plateRect.Location = PointWorldToGraph(-Plate.Size.Width, -Plate.Size.Length);
edgeSpacingRect.Location = PointWorldToGraph(
Plate.EdgeSpacing.Left - Plate.Size.Width,
Plate.EdgeSpacing.Bottom - Plate.Size.Height);
Plate.EdgeSpacing.Bottom - Plate.Size.Length);
break;
case 4:
plateRect.Location = PointWorldToGraph(0, -Plate.Size.Height);
plateRect.Location = PointWorldToGraph(0, -Plate.Size.Length);
edgeSpacingRect.Location = PointWorldToGraph(
Plate.EdgeSpacing.Left,
Plate.EdgeSpacing.Bottom - Plate.Size.Height);
Plate.EdgeSpacing.Bottom - Plate.Size.Length);
break;
default:
@@ -590,7 +590,7 @@ namespace OpenNest.Controls
{
Location = PointWorldToGraph(box.Location),
Width = LengthWorldToGui(box.Width),
Height = LengthWorldToGui(box.Height)
Height = LengthWorldToGui(box.Length)
};
g.DrawRectangle(ColorScheme.BoundingBoxPen, rect.X, rect.Y - rect.Height, rect.Width, rect.Height);

View File

@@ -56,7 +56,7 @@ namespace OpenNest.Forms
var sw = Stopwatch.StartNew();
var results = BestFitCache.GetOrCompute(
drawing, plate.Size.Width, plate.Size.Height, plate.PartSpacing);
drawing, plate.Size.Width, plate.Size.Length, plate.PartSpacing);
var findMs = sw.ElapsedMilliseconds;
var total = results.Count;

View File

@@ -173,7 +173,7 @@ namespace OpenNest.Forms
return;
}
if (TopSpacing + BottomSpacing >= size.Height)
if (TopSpacing + BottomSpacing >= size.Length)
{
applyButton.Enabled = false;
return;

View File

@@ -145,7 +145,7 @@ namespace OpenNest.Forms
return;
}
if (TopSpacing + BottomSpacing >= size.Height)
if (TopSpacing + BottomSpacing >= size.Length)
{
applyButton.Enabled = false;
return;

View File

@@ -43,8 +43,8 @@ namespace OpenNest.Forms
UpdateStatus();
UpdateGpuStatus();
if (GpuEvaluatorFactory.GpuAvailable)
BestFitCache.CreateEvaluator = (drawing, spacing) => GpuEvaluatorFactory.Create(drawing, spacing);
//if (GpuEvaluatorFactory.GpuAvailable)
// BestFitCache.CreateEvaluator = (drawing, spacing) => GpuEvaluatorFactory.Create(drawing, spacing);
}
private string GetNestName(DateTime date, int id)