refactor: move material and thickness from Plate to Nest

Material and thickness are properties of the nest (all plates share the
same material/gauge), not individual plates. This moves them to the Nest
class, removes them from Plate and PlateSettings, and updates the UI so
EditNestInfoForm has a material field while EditPlateForm no longer shows
thickness. The nest file format gains top-level thickness/material fields
with backward-compatible reading from PlateDefaults for old files.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-01 21:00:59 -04:00
parent 3e340e67e0
commit 9db7abcd37
18 changed files with 101 additions and 160 deletions
+2 -2
View File
@@ -59,6 +59,8 @@ public static class NestRunner
// 3. Multi-plate loop // 3. Multi-plate loop
var nest = new Nest(); var nest = new Nest();
nest.Thickness = request.Thickness;
nest.Material = new Material(request.Material);
var remaining = items.Select(item => item.Quantity).ToList(); var remaining = items.Select(item => item.Quantity).ToList();
while (remaining.Any(q => q > 0)) while (remaining.Any(q => q > 0))
@@ -67,9 +69,7 @@ public static class NestRunner
var plate = new Plate(request.SheetSize) var plate = new Plate(request.SheetSize)
{ {
Thickness = request.Thickness,
PartSpacing = request.Spacing, PartSpacing = request.Spacing,
Material = new Material(request.Material)
}; };
// Build items for this pass with remaining quantities // Build items for this pass with remaining quantities
+2 -3
View File
@@ -279,10 +279,9 @@ static class NestConsole
return; return;
} }
var templatePlate = new NestReader(options.TemplateFile).Read().PlateDefaults.CreateNew(); var templateNest = new NestReader(options.TemplateFile).Read();
plate.Thickness = templatePlate.Thickness; var templatePlate = templateNest.PlateDefaults.CreateNew();
plate.Quadrant = templatePlate.Quadrant; plate.Quadrant = templatePlate.Quadrant;
plate.Material = templatePlate.Material;
plate.EdgeSpacing = templatePlate.EdgeSpacing; plate.EdgeSpacing = templatePlate.EdgeSpacing;
plate.PartSpacing = templatePlate.PartSpacing; plate.PartSpacing = templatePlate.PartSpacing;
Console.WriteLine($"Template: {options.TemplateFile}"); Console.WriteLine($"Template: {options.TemplateFile}");
+5 -16
View File
@@ -21,6 +21,7 @@ namespace OpenNest
Plates.ItemRemoved += Plates_PlateRemoved; Plates.ItemRemoved += Plates_PlateRemoved;
Drawings = new DrawingCollection(); Drawings = new DrawingCollection();
PlateDefaults = new PlateSettings(); PlateDefaults = new PlateSettings();
Material = new Material();
Customer = string.Empty; Customer = string.Empty;
Notes = string.Empty; Notes = string.Empty;
} }
@@ -38,6 +39,10 @@ namespace OpenNest
public string AssistGas { get; set; } = ""; public string AssistGas { get; set; } = "";
public double Thickness { get; set; }
public Material Material { get; set; }
public Units Units { get; set; } public Units Units { get; set; }
public DateTime DateCreated { get; set; } public DateTime DateCreated { get; set; }
@@ -84,18 +89,6 @@ namespace OpenNest
set { plate.Quadrant = value; } set { plate.Quadrant = value; }
} }
public double Thickness
{
get { return plate.Thickness; }
set { plate.Thickness = value; }
}
public Material Material
{
get { return plate.Material; }
set { plate.Material = value; }
}
public Size Size public Size Size
{ {
get { return plate.Size; } get { return plate.Size; }
@@ -116,9 +109,7 @@ namespace OpenNest
public void SetFromExisting(Plate plate) public void SetFromExisting(Plate plate)
{ {
Thickness = plate.Thickness;
Quadrant = plate.Quadrant; Quadrant = plate.Quadrant;
Material = plate.Material;
Size = plate.Size; Size = plate.Size;
EdgeSpacing = plate.EdgeSpacing; EdgeSpacing = plate.EdgeSpacing;
PartSpacing = plate.PartSpacing; PartSpacing = plate.PartSpacing;
@@ -128,11 +119,9 @@ namespace OpenNest
{ {
return new Plate() return new Plate()
{ {
Thickness = Thickness,
Size = Size, Size = Size,
EdgeSpacing = EdgeSpacing, EdgeSpacing = EdgeSpacing,
PartSpacing = PartSpacing, PartSpacing = PartSpacing,
Material = Material,
Quadrant = Quadrant, Quadrant = Quadrant,
Quantity = 1 Quantity = 1
}; };
+4 -17
View File
@@ -43,7 +43,6 @@ namespace OpenNest
{ {
EdgeSpacing = new Spacing(); EdgeSpacing = new Spacing();
Size = size; Size = size;
Material = new Material();
Parts = new ObservableList<Part>(); Parts = new ObservableList<Part>();
Parts.ItemAdded += Parts_PartAdded; Parts.ItemAdded += Parts_PartAdded;
Parts.ItemRemoved += Parts_PartRemoved; Parts.ItemRemoved += Parts_PartRemoved;
@@ -63,11 +62,6 @@ namespace OpenNest
e.Item.BaseDrawing.Quantity.Nested -= Quantity; e.Item.BaseDrawing.Quantity.Nested -= Quantity;
} }
/// <summary>
/// Thickness of the plate.
/// </summary>
public double Thickness { get; set; }
/// <summary> /// <summary>
/// The spacing between parts. /// The spacing between parts.
/// </summary> /// </summary>
@@ -83,11 +77,6 @@ namespace OpenNest
/// </summary> /// </summary>
public Size Size { get; set; } public Size Size { get; set; }
/// <summary>
/// Material the plate is made out of.
/// </summary>
public Material Material { get; set; }
public CNC.CuttingStrategy.CuttingParameters CuttingParameters { get; set; } public CNC.CuttingStrategy.CuttingParameters CuttingParameters { get; set; }
/// <summary> /// <summary>
@@ -571,19 +560,17 @@ namespace OpenNest
/// <summary> /// <summary>
/// Gets the volume of the plate. /// Gets the volume of the plate.
/// </summary> /// </summary>
/// <returns></returns> public double Volume(double thickness)
public double Volume()
{ {
return Area() * Thickness; return Area() * thickness;
} }
/// <summary> /// <summary>
/// Gets the weight of the plate. /// Gets the weight of the plate.
/// </summary> /// </summary>
/// <returns></returns> public double Weight(double thickness, double density)
public double Weight()
{ {
return Volume() * Material.Density; return Volume(thickness) * density;
} }
/// <summary> /// <summary>
+2 -2
View File
@@ -24,6 +24,8 @@ namespace OpenNest.IO
public string DateLastModified { get; init; } = ""; public string DateLastModified { get; init; } = "";
public string Notes { get; init; } = ""; public string Notes { get; init; } = "";
public string AssistGas { get; init; } = ""; public string AssistGas { get; init; } = "";
public double Thickness { get; init; }
public MaterialDto Material { get; init; } = new();
public PlateDefaultsDto PlateDefaults { get; init; } = new(); public PlateDefaultsDto PlateDefaults { get; init; } = new();
public List<DrawingDto> Drawings { get; init; } = new(); public List<DrawingDto> Drawings { get; init; } = new();
public List<PlateDto> Plates { get; init; } = new(); public List<PlateDto> Plates { get; init; } = new();
@@ -57,11 +59,9 @@ namespace OpenNest.IO
{ {
public int Id { get; init; } public int Id { get; init; }
public SizeDto Size { get; init; } = new(); public SizeDto Size { get; init; } = new();
public double Thickness { get; init; }
public int Quadrant { get; init; } = 1; public int Quadrant { get; init; } = 1;
public int Quantity { get; init; } = 1; public int Quantity { get; init; } = 1;
public double PartSpacing { get; init; } public double PartSpacing { get; init; }
public MaterialDto Material { get; init; } = new();
public SpacingDto EdgeSpacing { get; init; } = new(); public SpacingDto EdgeSpacing { get; init; } = new();
public double GrainAngle { get; init; } public double GrainAngle { get; init; }
public List<PartDto> Parts { get; init; } = new(); public List<PartDto> Parts { get; init; } = new();
+6 -5
View File
@@ -180,13 +180,16 @@ namespace OpenNest.IO
nest.Notes = dto.Notes; nest.Notes = dto.Notes;
nest.AssistGas = dto.AssistGas ?? ""; nest.AssistGas = dto.AssistGas ?? "";
// Plate defaults // Nest-level material and thickness (fall back to PlateDefaults for old files)
var pd = dto.PlateDefaults; var pd = dto.PlateDefaults;
var matDto = dto.Material ?? pd.Material;
nest.Thickness = dto.Thickness > 0 ? dto.Thickness : pd.Thickness;
nest.Material = new Material(matDto.Name, matDto.Grade, matDto.Density);
// Plate defaults
nest.PlateDefaults.Size = new OpenNest.Geometry.Size(pd.Size.Width, pd.Size.Length); nest.PlateDefaults.Size = new OpenNest.Geometry.Size(pd.Size.Width, pd.Size.Length);
nest.PlateDefaults.Thickness = pd.Thickness;
nest.PlateDefaults.Quadrant = pd.Quadrant; nest.PlateDefaults.Quadrant = pd.Quadrant;
nest.PlateDefaults.PartSpacing = pd.PartSpacing; nest.PlateDefaults.PartSpacing = pd.PartSpacing;
nest.PlateDefaults.Material = new Material(pd.Material.Name, pd.Material.Grade, pd.Material.Density);
nest.PlateDefaults.EdgeSpacing = new Spacing(pd.EdgeSpacing.Left, pd.EdgeSpacing.Bottom, pd.EdgeSpacing.Right, pd.EdgeSpacing.Top); nest.PlateDefaults.EdgeSpacing = new Spacing(pd.EdgeSpacing.Left, pd.EdgeSpacing.Bottom, pd.EdgeSpacing.Right, pd.EdgeSpacing.Top);
// Drawings // Drawings
@@ -198,11 +201,9 @@ namespace OpenNest.IO
{ {
var plate = new Plate(); var plate = new Plate();
plate.Size = new OpenNest.Geometry.Size(p.Size.Width, p.Size.Length); plate.Size = new OpenNest.Geometry.Size(p.Size.Width, p.Size.Length);
plate.Thickness = p.Thickness;
plate.Quadrant = p.Quadrant; plate.Quadrant = p.Quadrant;
plate.Quantity = p.Quantity; plate.Quantity = p.Quantity;
plate.PartSpacing = p.PartSpacing; plate.PartSpacing = p.PartSpacing;
plate.Material = new Material(p.Material.Name, p.Material.Grade, p.Material.Density);
plate.EdgeSpacing = new Spacing(p.EdgeSpacing.Left, p.EdgeSpacing.Bottom, p.EdgeSpacing.Right, p.EdgeSpacing.Top); plate.EdgeSpacing = new Spacing(p.EdgeSpacing.Left, p.EdgeSpacing.Bottom, p.EdgeSpacing.Right, p.EdgeSpacing.Top);
plate.GrainAngle = p.GrainAngle; plate.GrainAngle = p.GrainAngle;
+11 -11
View File
@@ -79,6 +79,13 @@ namespace OpenNest.IO
DateLastModified = nest.DateLastModified.ToString("o"), DateLastModified = nest.DateLastModified.ToString("o"),
Notes = nest.Notes ?? "", Notes = nest.Notes ?? "",
AssistGas = nest.AssistGas ?? "", AssistGas = nest.AssistGas ?? "",
Thickness = nest.Thickness,
Material = new MaterialDto
{
Name = nest.Material.Name ?? "",
Grade = nest.Material.Grade ?? "",
Density = nest.Material.Density
},
PlateDefaults = BuildPlateDefaultsDto(), PlateDefaults = BuildPlateDefaultsDto(),
Drawings = BuildDrawingDtos(), Drawings = BuildDrawingDtos(),
Plates = BuildPlateDtos() Plates = BuildPlateDtos()
@@ -91,14 +98,14 @@ namespace OpenNest.IO
return new PlateDefaultsDto return new PlateDefaultsDto
{ {
Size = new SizeDto { Width = pd.Size.Width, Length = pd.Size.Length }, Size = new SizeDto { Width = pd.Size.Width, Length = pd.Size.Length },
Thickness = pd.Thickness, Thickness = nest.Thickness,
Quadrant = pd.Quadrant, Quadrant = pd.Quadrant,
PartSpacing = pd.PartSpacing, PartSpacing = pd.PartSpacing,
Material = new MaterialDto Material = new MaterialDto
{ {
Name = pd.Material.Name ?? "", Name = nest.Material.Name ?? "",
Grade = pd.Material.Grade ?? "", Grade = nest.Material.Grade ?? "",
Density = pd.Material.Density Density = nest.Material.Density
}, },
EdgeSpacing = new SpacingDto EdgeSpacing = new SpacingDto
{ {
@@ -196,16 +203,9 @@ namespace OpenNest.IO
{ {
Id = i + 1, Id = i + 1,
Size = new SizeDto { Width = plate.Size.Width, Length = plate.Size.Length }, Size = new SizeDto { Width = plate.Size.Width, Length = plate.Size.Length },
Thickness = plate.Thickness,
Quadrant = plate.Quadrant, Quadrant = plate.Quadrant,
Quantity = plate.Quantity, Quantity = plate.Quantity,
PartSpacing = plate.PartSpacing, PartSpacing = plate.PartSpacing,
Material = new MaterialDto
{
Name = plate.Material.Name ?? "",
Grade = plate.Material.Grade ?? "",
Density = plate.Material.Density
},
EdgeSpacing = new SpacingDto EdgeSpacing = new SpacingDto
{ {
Left = plate.EdgeSpacing.Left, Left = plate.EdgeSpacing.Left,
+2 -2
View File
@@ -33,8 +33,8 @@ namespace OpenNest.Mcp.Tools
sb.AppendLine($"Plate {plateIndex}:"); sb.AppendLine($"Plate {plateIndex}:");
sb.AppendLine($" Size: {plate.Size.Width:F1} x {plate.Size.Length:F1}"); sb.AppendLine($" Size: {plate.Size.Width:F1} x {plate.Size.Length:F1}");
sb.AppendLine($" Quadrant: {plate.Quadrant}"); sb.AppendLine($" Quadrant: {plate.Quadrant}");
sb.AppendLine($" Thickness: {plate.Thickness:F2}"); sb.AppendLine($" Thickness: {_session.Nest?.Thickness:F2}");
sb.AppendLine($" Material: {plate.Material.Name}"); sb.AppendLine($" Material: {_session.Nest?.Material?.Name}");
sb.AppendLine($" Part spacing: {plate.PartSpacing:F2}"); 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($" 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.Length:F1}"); sb.AppendLine($" Work area: {work.X:F1},{work.Y:F1} {work.Width:F1}x{work.Length:F1}");
+2 -2
View File
@@ -31,8 +31,8 @@ namespace OpenNest.Mcp.Tools
plate.Quadrant = quadrant; plate.Quadrant = quadrant;
plate.Quantity = 1; plate.Quantity = 1;
if (!string.IsNullOrEmpty(material)) if (!string.IsNullOrEmpty(material) && _session.Nest != null)
plate.Material.Name = material; _session.Nest.Material = new Material(material);
_session.Plates.Add(plate); _session.Plates.Add(plate);
@@ -75,11 +75,9 @@ namespace OpenNest.Posts.Cincinnati
var gas = MaterialLibraryResolver.ResolveGas(nest, Config); var gas = MaterialLibraryResolver.ResolveGas(nest, Config);
var etchLibrary = resolver.ResolveEtchLibrary(Config.DefaultEtchGas); var etchLibrary = resolver.ResolveEtchLibrary(Config.DefaultEtchGas);
// Resolve cut library from first plate for preamble // Resolve cut library from nest material/thickness for preamble
var firstPlate = plates.FirstOrDefault(); var firstPlate = plates.FirstOrDefault();
var initialCutLibrary = firstPlate != null var initialCutLibrary = resolver.ResolveCutLibrary(nest.Material?.Name ?? "", nest.Thickness, gas);
? resolver.ResolveCutLibrary(firstPlate.Material?.Name ?? "", firstPlate.Thickness, gas)
: "";
// 4. Build part sub-program registry (if enabled) // 4. Build part sub-program registry (if enabled)
Dictionary<(int, long), int> partSubprograms = null; Dictionary<(int, long), int> partSubprograms = null;
@@ -92,8 +90,8 @@ namespace OpenNest.Posts.Cincinnati
var preamble = new CincinnatiPreambleWriter(Config); var preamble = new CincinnatiPreambleWriter(Config);
var sheetWriter = new CincinnatiSheetWriter(Config, vars); var sheetWriter = new CincinnatiSheetWriter(Config, vars);
// 6. Build material description from first plate // 6. Build material description from nest
var material = firstPlate?.Material; var material = nest.Material;
var materialDesc = material != null var materialDesc = material != null
? $"{material.Name}{(string.IsNullOrEmpty(material.Grade) ? "" : $", {material.Grade}")}" ? $"{material.Name}{(string.IsNullOrEmpty(material.Grade) ? "" : $", {material.Grade}")}"
: ""; : "";
@@ -113,7 +111,7 @@ namespace OpenNest.Posts.Cincinnati
var plate = plates[i]; var plate = plates[i];
var sheetIndex = i + 1; var sheetIndex = i + 1;
var subNumber = Config.SheetSubprogramStart + i; var subNumber = Config.SheetSubprogramStart + i;
var cutLibrary = resolver.ResolveCutLibrary(plate.Material?.Name ?? "", plate.Thickness, gas); var cutLibrary = resolver.ResolveCutLibrary(nest.Material?.Name ?? "", nest.Thickness, gas);
var isLastSheet = i == plates.Count - 1; var isLastSheet = i == plates.Count - 1;
sheetWriter.Write(writer, plate, nest.Name ?? "NEST", sheetIndex, subNumber, sheetWriter.Write(writer, plate, nest.Name ?? "NEST", sheetIndex, subNumber,
cutLibrary, etchLibrary, partSubprograms, isLastSheet); cutLibrary, etchLibrary, partSubprograms, isLastSheet);
-2
View File
@@ -782,8 +782,6 @@ namespace OpenNest.Controls
{ {
Quadrant = Plate.Quadrant, Quadrant = Plate.Quadrant,
PartSpacing = Plate.PartSpacing, PartSpacing = Plate.PartSpacing,
Thickness = Plate.Thickness,
Material = Plate.Material,
}; };
previewPlate.EdgeSpacing = Plate.EdgeSpacing; previewPlate.EdgeSpacing = Plate.EdgeSpacing;
progressForm.PreviewPlate = previewPlate; progressForm.PreviewPlate = previewPlate;
+2 -2
View File
@@ -400,8 +400,8 @@ namespace OpenNest.Forms
nest.DateCreated = DateTime.Now; nest.DateCreated = DateTime.Now;
nest.DateLastModified = DateTime.Now; nest.DateLastModified = DateTime.Now;
nest.PlateDefaults.Size = new Geometry.Size(plateWidth, plateLength); nest.PlateDefaults.Size = new Geometry.Size(plateWidth, plateLength);
nest.PlateDefaults.Thickness = thickness; nest.Thickness = thickness;
nest.PlateDefaults.Material = new Material(material); nest.Material = new Material(material);
nest.PlateDefaults.Quadrant = 1; nest.PlateDefaults.Quadrant = 1;
nest.PlateDefaults.PartSpacing = 1; nest.PlateDefaults.PartSpacing = 1;
nest.PlateDefaults.EdgeSpacing = new Spacing(1, 1, 1, 1); nest.PlateDefaults.EdgeSpacing = new Spacing(1, 1, 1, 1);
+37 -12
View File
@@ -62,6 +62,8 @@
this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox(); this.textBox2 = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label();
this.labelMaterial = new System.Windows.Forms.Label();
this.materialBox = new System.Windows.Forms.TextBox();
this.tabPage2 = new System.Windows.Forms.TabPage(); this.tabPage2 = new System.Windows.Forms.TabPage();
this.tabPage3 = new System.Windows.Forms.TabPage(); this.tabPage3 = new System.Windows.Forms.TabPage();
this.notesBox = new System.Windows.Forms.TextBox(); this.notesBox = new System.Windows.Forms.TextBox();
@@ -401,28 +403,31 @@
this.tableLayoutPanel3.ColumnCount = 2; this.tableLayoutPanel3.ColumnCount = 2;
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel3.Controls.Add(this.tableLayoutPanel4, 1, 5); this.tableLayoutPanel3.Controls.Add(this.tableLayoutPanel4, 1, 6);
this.tableLayoutPanel3.Controls.Add(this.label1, 0, 0); this.tableLayoutPanel3.Controls.Add(this.label1, 0, 0);
this.tableLayoutPanel3.Controls.Add(this.nameBox, 1, 0); this.tableLayoutPanel3.Controls.Add(this.nameBox, 1, 0);
this.tableLayoutPanel3.Controls.Add(this.label2, 0, 4); this.tableLayoutPanel3.Controls.Add(this.label2, 0, 5);
this.tableLayoutPanel3.Controls.Add(this.labelThk, 0, 3); this.tableLayoutPanel3.Controls.Add(this.labelThk, 0, 3);
this.tableLayoutPanel3.Controls.Add(this.thicknessBox, 1, 3); this.tableLayoutPanel3.Controls.Add(this.thicknessBox, 1, 3);
this.tableLayoutPanel3.Controls.Add(this.labelMaterial, 0, 4);
this.tableLayoutPanel3.Controls.Add(this.materialBox, 1, 4);
this.tableLayoutPanel3.Controls.Add(this.label3, 0, 1); this.tableLayoutPanel3.Controls.Add(this.label3, 0, 1);
this.tableLayoutPanel3.Controls.Add(this.label4, 0, 2); this.tableLayoutPanel3.Controls.Add(this.label4, 0, 2);
this.tableLayoutPanel3.Controls.Add(this.customerBox, 1, 4); this.tableLayoutPanel3.Controls.Add(this.customerBox, 1, 5);
this.tableLayoutPanel3.Controls.Add(this.textBox1, 1, 1); this.tableLayoutPanel3.Controls.Add(this.textBox1, 1, 1);
this.tableLayoutPanel3.Controls.Add(this.textBox2, 1, 2); this.tableLayoutPanel3.Controls.Add(this.textBox2, 1, 2);
this.tableLayoutPanel3.Controls.Add(this.label5, 0, 5); this.tableLayoutPanel3.Controls.Add(this.label5, 0, 6);
this.tableLayoutPanel3.Location = new System.Drawing.Point(6, 6); this.tableLayoutPanel3.Location = new System.Drawing.Point(6, 6);
this.tableLayoutPanel3.Name = "tableLayoutPanel3"; this.tableLayoutPanel3.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 6; this.tableLayoutPanel3.RowCount = 7;
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16.66667F)); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.28571F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16.66667F)); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.28571F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16.66667F)); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.28571F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16.66667F)); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.28571F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16.66667F)); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.28571F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16.66667F)); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.28571F));
this.tableLayoutPanel3.Size = new System.Drawing.Size(362, 240); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.28571F));
this.tableLayoutPanel3.Size = new System.Drawing.Size(362, 280);
this.tableLayoutPanel3.TabIndex = 0; this.tableLayoutPanel3.TabIndex = 0;
// //
// tableLayoutPanel4 // tableLayoutPanel4
@@ -498,6 +503,24 @@
this.thicknessBox.Suffix = ""; this.thicknessBox.Suffix = "";
this.thicknessBox.TabIndex = 7; this.thicknessBox.TabIndex = 7;
// //
// labelMaterial
//
this.labelMaterial.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.labelMaterial.AutoSize = true;
this.labelMaterial.Location = new System.Drawing.Point(3, 162);
this.labelMaterial.Name = "labelMaterial";
this.labelMaterial.Size = new System.Drawing.Size(126, 16);
this.labelMaterial.TabIndex = 10;
this.labelMaterial.Text = "Material :";
//
// materialBox
//
this.materialBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.materialBox.Location = new System.Drawing.Point(135, 159);
this.materialBox.Name = "materialBox";
this.materialBox.Size = new System.Drawing.Size(224, 22);
this.materialBox.TabIndex = 11;
//
// label3 // label3
// //
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
@@ -705,5 +728,7 @@
private System.Windows.Forms.RadioButton radioButton1; private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.RadioButton radioButton2; private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label labelMaterial;
private System.Windows.Forms.TextBox materialBox;
} }
} }
+10 -2
View File
@@ -106,6 +106,12 @@ namespace OpenNest.Forms
set { thicknessBox.Value = (decimal)value; } set { thicknessBox.Value = (decimal)value; }
} }
public string MaterialName
{
get { return materialBox.Text; }
set { materialBox.Text = value; }
}
public void SetUnits(Units units) public void SetUnits(Units units)
{ {
switch (units) switch (units)
@@ -189,7 +195,8 @@ namespace OpenNest.Forms
Customer = nest.Customer; Customer = nest.Customer;
DateCreated = nest.DateCreated; DateCreated = nest.DateCreated;
DateLastModified = nest.DateLastModified; DateLastModified = nest.DateLastModified;
Thickness = nest.PlateDefaults.Thickness; Thickness = nest.Thickness;
MaterialName = nest.Material?.Name ?? "";
SizeString = nest.PlateDefaults.Size.ToString(); SizeString = nest.PlateDefaults.Size.ToString();
PartSpacing = nest.PlateDefaults.PartSpacing; PartSpacing = nest.PlateDefaults.PartSpacing;
LeftSpacing = nest.PlateDefaults.EdgeSpacing.Left; LeftSpacing = nest.PlateDefaults.EdgeSpacing.Left;
@@ -209,7 +216,8 @@ namespace OpenNest.Forms
nest.Customer = Customer; nest.Customer = Customer;
nest.DateCreated = DateCreated; nest.DateCreated = DateCreated;
nest.DateLastModified = DateLastModified; nest.DateLastModified = DateLastModified;
nest.PlateDefaults.Thickness = Thickness; nest.Thickness = Thickness;
nest.Material = new Material(MaterialName);
nest.PlateDefaults.Size = OpenNest.Geometry.Size.Parse(SizeString); nest.PlateDefaults.Size = OpenNest.Geometry.Size.Parse(SizeString);
nest.PlateDefaults.PartSpacing = PartSpacing; nest.PlateDefaults.PartSpacing = PartSpacing;
nest.PlateDefaults.EdgeSpacing = new Spacing(LeftSpacing, BottomSpacing, RightSpacing, TopSpacing); nest.PlateDefaults.EdgeSpacing = new Spacing(LeftSpacing, BottomSpacing, RightSpacing, TopSpacing);
+7 -42
View File
@@ -32,7 +32,6 @@
this.labelQty = new System.Windows.Forms.Label(); this.labelQty = new System.Windows.Forms.Label();
this.labelSize = new System.Windows.Forms.Label(); this.labelSize = new System.Windows.Forms.Label();
this.textBoxSize = new System.Windows.Forms.TextBox(); this.textBoxSize = new System.Windows.Forms.TextBox();
this.labelThk = new System.Windows.Forms.Label();
this.labelPartSpacing = new System.Windows.Forms.Label(); this.labelPartSpacing = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox(); this.groupBox1 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
@@ -50,7 +49,6 @@
this.numericUpDownEdgeSpacingRight = new OpenNest.Controls.NumericUpDown(); this.numericUpDownEdgeSpacingRight = new OpenNest.Controls.NumericUpDown();
this.numericUpDownEdgeSpacingBottom = new OpenNest.Controls.NumericUpDown(); this.numericUpDownEdgeSpacingBottom = new OpenNest.Controls.NumericUpDown();
this.numericUpDownQty = new OpenNest.Controls.NumericUpDown(); this.numericUpDownQty = new OpenNest.Controls.NumericUpDown();
this.numericUpDownThickness = new OpenNest.Controls.NumericUpDown();
this.numericUpDownPartSpacing = new OpenNest.Controls.NumericUpDown(); this.numericUpDownPartSpacing = new OpenNest.Controls.NumericUpDown();
this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
@@ -62,7 +60,6 @@
((System.ComponentModel.ISupportInitialize)(this.numericUpDownEdgeSpacingRight)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownEdgeSpacingRight)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownEdgeSpacingBottom)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownEdgeSpacingBottom)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownQty)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownQty)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownThickness)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownPartSpacing)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownPartSpacing)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
@@ -75,18 +72,15 @@
this.tableLayoutPanel1.Controls.Add(this.labelSize, 0, 0); this.tableLayoutPanel1.Controls.Add(this.labelSize, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.textBoxSize, 1, 0); this.tableLayoutPanel1.Controls.Add(this.textBoxSize, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.numericUpDownQty, 1, 1); this.tableLayoutPanel1.Controls.Add(this.numericUpDownQty, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.numericUpDownThickness, 1, 2); this.tableLayoutPanel1.Controls.Add(this.labelPartSpacing, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.labelThk, 0, 2); this.tableLayoutPanel1.Controls.Add(this.numericUpDownPartSpacing, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.labelPartSpacing, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.numericUpDownPartSpacing, 1, 3);
this.tableLayoutPanel1.Location = new System.Drawing.Point(18, 12); this.tableLayoutPanel1.Location = new System.Drawing.Point(18, 12);
this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 4; this.tableLayoutPanel1.RowCount = 3;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F)); this.tableLayoutPanel1.Size = new System.Drawing.Size(236, 108);
this.tableLayoutPanel1.Size = new System.Drawing.Size(236, 144);
this.tableLayoutPanel1.TabIndex = 0; this.tableLayoutPanel1.TabIndex = 0;
// //
// labelQty // labelQty
@@ -120,17 +114,6 @@
this.textBoxSize.TabIndex = 1; this.textBoxSize.TabIndex = 1;
this.textBoxSize.TextChanged += new System.EventHandler(this.textBox1_TextChanged); this.textBoxSize.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
// //
// labelThk
//
this.labelThk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.labelThk.AutoSize = true;
this.labelThk.Location = new System.Drawing.Point(3, 82);
this.labelThk.Name = "labelThk";
this.labelThk.Size = new System.Drawing.Size(91, 16);
this.labelThk.TabIndex = 4;
this.labelThk.Text = "Thickness :";
this.labelThk.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// labelPartSpacing // labelPartSpacing
// //
this.labelPartSpacing.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.labelPartSpacing.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
@@ -353,21 +336,6 @@
this.numericUpDownQty.Suffix = ""; this.numericUpDownQty.Suffix = "";
this.numericUpDownQty.TabIndex = 3; this.numericUpDownQty.TabIndex = 3;
// //
// numericUpDownThickness
//
this.numericUpDownThickness.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.numericUpDownThickness.DecimalPlaces = 4;
this.numericUpDownThickness.Increment = new decimal(new int[] {
25,
0,
0,
131072});
this.numericUpDownThickness.Location = new System.Drawing.Point(100, 79);
this.numericUpDownThickness.Name = "numericUpDownThickness";
this.numericUpDownThickness.Size = new System.Drawing.Size(133, 22);
this.numericUpDownThickness.Suffix = "";
this.numericUpDownThickness.TabIndex = 5;
//
// numericUpDownPartSpacing // numericUpDownPartSpacing
// //
this.numericUpDownPartSpacing.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.numericUpDownPartSpacing.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
@@ -414,7 +382,6 @@
((System.ComponentModel.ISupportInitialize)(this.numericUpDownEdgeSpacingRight)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownEdgeSpacingRight)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownEdgeSpacingBottom)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownEdgeSpacingBottom)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownQty)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownQty)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownThickness)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownPartSpacing)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownPartSpacing)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
@@ -441,8 +408,6 @@
private Controls.NumericUpDown numericUpDownQty; private Controls.NumericUpDown numericUpDownQty;
private Controls.QuadrantSelect quadrantSelect1; private Controls.QuadrantSelect quadrantSelect1;
private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.GroupBox groupBox2;
private Controls.NumericUpDown numericUpDownThickness;
private System.Windows.Forms.Label labelThk;
private System.Windows.Forms.Label labelPartSpacing; private System.Windows.Forms.Label labelPartSpacing;
private Controls.NumericUpDown numericUpDownPartSpacing; private Controls.NumericUpDown numericUpDownPartSpacing;
private Controls.BottomPanel bottomPanel1; private Controls.BottomPanel bottomPanel1;
-9
View File
@@ -58,7 +58,6 @@ namespace OpenNest.Forms
var controls = new[] var controls = new[]
{ {
numericUpDownThickness,
numericUpDownPartSpacing, numericUpDownPartSpacing,
numericUpDownEdgeSpacingBottom, numericUpDownEdgeSpacingBottom,
numericUpDownEdgeSpacingLeft, numericUpDownEdgeSpacingLeft,
@@ -110,12 +109,6 @@ namespace OpenNest.Forms
set { numericUpDownPartSpacing.Value = (decimal)value; } set { numericUpDownPartSpacing.Value = (decimal)value; }
} }
public double Thickness
{
get { return (double)numericUpDownThickness.Value; }
set { numericUpDownThickness.Value = (decimal)value; }
}
public int Quantity public int Quantity
{ {
get { return (int)numericUpDownQty.Value; } get { return (int)numericUpDownQty.Value; }
@@ -163,7 +156,6 @@ namespace OpenNest.Forms
PartSpacing = plate.PartSpacing; PartSpacing = plate.PartSpacing;
Quantity = plate.Quantity; Quantity = plate.Quantity;
Quadrant = plate.Quadrant; Quadrant = plate.Quadrant;
Thickness = plate.Thickness;
} }
private void Save() private void Save()
@@ -176,7 +168,6 @@ namespace OpenNest.Forms
plate.PartSpacing = PartSpacing; plate.PartSpacing = PartSpacing;
plate.Quantity = Quantity; plate.Quantity = Quantity;
plate.Quadrant = Quadrant; plate.Quadrant = Quadrant;
plate.Thickness = Thickness;
} }
private void textBox1_TextChanged(object sender, EventArgs e) private void textBox1_TextChanged(object sender, EventArgs e)
-2
View File
@@ -1017,8 +1017,6 @@ namespace OpenNest.Forms
{ {
Quadrant = source.Quadrant, Quadrant = source.Quadrant,
PartSpacing = source.PartSpacing, PartSpacing = source.PartSpacing,
Thickness = source.Thickness,
Material = source.Material,
}; };
plate.EdgeSpacing = source.EdgeSpacing; plate.EdgeSpacing = source.EdgeSpacing;
return plate; return plate;
-18
View File
@@ -15,13 +15,10 @@ namespace OpenNest.Forms
{ {
ColorScheme colorScheme1 = new ColorScheme(); ColorScheme colorScheme1 = new ColorScheme();
Plate plate1 = new Plate(); Plate plate1 = new Plate();
Material material1 = new Material();
Collections.ObservableList<Part> observableList_11 = new Collections.ObservableList<Part>(); Collections.ObservableList<Part> observableList_11 = new Collections.ObservableList<Part>();
Plate plate2 = new Plate(); Plate plate2 = new Plate();
Material material2 = new Material();
Collections.ObservableList<Part> observableList_12 = new Collections.ObservableList<Part>(); Collections.ObservableList<Part> observableList_12 = new Collections.ObservableList<Part>();
Plate plate3 = new Plate(); Plate plate3 = new Plate();
Material material3 = new Material();
Collections.ObservableList<Part> observableList_13 = new Collections.ObservableList<Part>(); Collections.ObservableList<Part> observableList_13 = new Collections.ObservableList<Part>();
topPanel = new System.Windows.Forms.FlowLayoutPanel(); topPanel = new System.Windows.Forms.FlowLayoutPanel();
lblDrawingA = new System.Windows.Forms.Label(); lblDrawingA = new System.Windows.Forms.Label();
@@ -218,15 +215,10 @@ namespace OpenNest.Forms
cellView.Name = "cellView"; cellView.Name = "cellView";
cellView.OffsetIncrementDistance = 10D; cellView.OffsetIncrementDistance = 10D;
cellView.OffsetTolerance = 0.001D; cellView.OffsetTolerance = 0.001D;
material1.Density = 0D;
material1.Grade = null;
material1.Name = null;
plate1.Material = material1;
plate1.Parts = observableList_11; plate1.Parts = observableList_11;
plate1.PartSpacing = 0D; plate1.PartSpacing = 0D;
plate1.Quadrant = 1; plate1.Quadrant = 1;
plate1.Quantity = 0; plate1.Quantity = 0;
plate1.Thickness = 0D;
cellView.Plate = plate1; cellView.Plate = plate1;
cellView.RotateIncrementAngle = 10D; cellView.RotateIncrementAngle = 10D;
cellView.Size = new System.Drawing.Size(610, 677); cellView.Size = new System.Drawing.Size(610, 677);
@@ -274,15 +266,10 @@ namespace OpenNest.Forms
hPreview.Name = "hPreview"; hPreview.Name = "hPreview";
hPreview.OffsetIncrementDistance = 10D; hPreview.OffsetIncrementDistance = 10D;
hPreview.OffsetTolerance = 0.001D; hPreview.OffsetTolerance = 0.001D;
material2.Density = 0D;
material2.Grade = null;
material2.Name = null;
plate2.Material = material2;
plate2.Parts = observableList_12; plate2.Parts = observableList_12;
plate2.PartSpacing = 0D; plate2.PartSpacing = 0D;
plate2.Quadrant = 1; plate2.Quadrant = 1;
plate2.Quantity = 0; plate2.Quantity = 0;
plate2.Thickness = 0D;
hPreview.Plate = plate2; hPreview.Plate = plate2;
hPreview.RotateIncrementAngle = 10D; hPreview.RotateIncrementAngle = 10D;
hPreview.Size = new System.Drawing.Size(605, 313); hPreview.Size = new System.Drawing.Size(605, 313);
@@ -322,15 +309,10 @@ namespace OpenNest.Forms
vPreview.Name = "vPreview"; vPreview.Name = "vPreview";
vPreview.OffsetIncrementDistance = 10D; vPreview.OffsetIncrementDistance = 10D;
vPreview.OffsetTolerance = 0.001D; vPreview.OffsetTolerance = 0.001D;
material3.Density = 0D;
material3.Grade = null;
material3.Name = null;
plate3.Material = material3;
plate3.Parts = observableList_13; plate3.Parts = observableList_13;
plate3.PartSpacing = 0D; plate3.PartSpacing = 0D;
plate3.Quadrant = 1; plate3.Quadrant = 1;
plate3.Quantity = 0; plate3.Quantity = 0;
plate3.Thickness = 0D;
vPreview.Plate = plate3; vPreview.Plate = plate3;
vPreview.RotateIncrementAngle = 10D; vPreview.RotateIncrementAngle = 10D;
vPreview.Size = new System.Drawing.Size(605, 320); vPreview.Size = new System.Drawing.Size(605, 320);