fix: correct Size width/length ordering and add CLI docs to README
Size.Parse and ToString now use WxL format (width first) matching the natural convention. Fixed the Plate(w,l) constructor which was swapping args when creating Size. Fixed PlateView.DrawPlate and DrawControl ZoomToArea which had width/length mapped to the wrong screen axes. Simplified Console --size parsing to use Size.TryParse instead of manual split with confusing PlateHeight/PlateWidth fields. Added Command-Line Interface section to README documenting all console options. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,14 +6,14 @@ namespace OpenNest.Geometry
|
||||
{
|
||||
public Size(double width, double length)
|
||||
{
|
||||
Length = length;
|
||||
Width = width;
|
||||
Length = length;
|
||||
}
|
||||
|
||||
public double Length;
|
||||
|
||||
public double Width;
|
||||
|
||||
public double Length;
|
||||
|
||||
public static Size Parse(string size)
|
||||
{
|
||||
var a = size.ToUpper().Split('X');
|
||||
@@ -21,8 +21,8 @@ namespace OpenNest.Geometry
|
||||
if (a.Length > 2)
|
||||
throw new FormatException("Invalid size format.");
|
||||
|
||||
var length = double.Parse(a[0]);
|
||||
var width = double.Parse(a[1]);
|
||||
var width = double.Parse(a[0]);
|
||||
var length = double.Parse(a[1]);
|
||||
|
||||
return new Size(width, length);
|
||||
}
|
||||
@@ -42,14 +42,8 @@ namespace OpenNest.Geometry
|
||||
return true;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0} x {1}", Length, Width);
|
||||
}
|
||||
|
||||
public string ToString(int decimalPlaces)
|
||||
{
|
||||
return string.Format("{0} x {1}", System.Math.Round(Length, decimalPlaces), System.Math.Round(Width, decimalPlaces));
|
||||
}
|
||||
public override string ToString() => $"{Width} x {Length}";
|
||||
|
||||
public string ToString(int decimalPlaces) => $"{System.Math.Round(Width, decimalPlaces)} x {System.Math.Round(Length, decimalPlaces)}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace OpenNest
|
||||
}
|
||||
|
||||
public Plate(double width, double length)
|
||||
: this(new Size(length, width))
|
||||
: this(new Size(width, length))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user