4 Commits
Author SHA1 Message Date
ajandClaude Opus 4.6 97d897e885 fix: filter to cut-layer entities when building contour info in ActionLeadIn
Only include cut-layer entities when building the ShapeProfile for lead-in
placement, instead of removing just scribe entities. This prevents display,
lead-in, and lead-out geometry from interfering with contour detection.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 22:03:01 -04:00
ajandClaude Opus 4.6 9db7abcd37 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>
2026-04-01 21:00:59 -04:00
ajandClaude Opus 4.6 3e340e67e0 refactor: organize test project into subdirectories by feature area
Move 43 root-level test files into feature-specific subdirectories
mirroring the main codebase structure: Geometry, Fill, BestFit, CutOffs,
CuttingStrategy, Engine, IO. Update namespaces to match folder paths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 20:46:43 -04:00
ajandClaude Opus 4.6 7a6c407edd feat: add owner-drawn color swatch to FilterPanel
Switch colorsList from CheckedListBox (which silently ignores owner
draw) to a plain ListBox with manual checkbox, color swatch, and hex
label rendering. Clone entities in ProgramEditorControl preview to
avoid mutating originals. Remove contour color application from
CadConverterForm. Fix struct null comparison warning in SplitDrawingForm.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 20:24:28 -04:00
67 changed files with 304 additions and 359 deletions
+2 -2
View File
@@ -59,6 +59,8 @@ public static class NestRunner
// 3. Multi-plate loop
var nest = new Nest();
nest.Thickness = request.Thickness;
nest.Material = new Material(request.Material);
var remaining = items.Select(item => item.Quantity).ToList();
while (remaining.Any(q => q > 0))
@@ -67,9 +69,7 @@ public static class NestRunner
var plate = new Plate(request.SheetSize)
{
Thickness = request.Thickness,
PartSpacing = request.Spacing,
Material = new Material(request.Material)
};
// Build items for this pass with remaining quantities
+2 -3
View File
@@ -279,10 +279,9 @@ static class NestConsole
return;
}
var templatePlate = new NestReader(options.TemplateFile).Read().PlateDefaults.CreateNew();
plate.Thickness = templatePlate.Thickness;
var templateNest = new NestReader(options.TemplateFile).Read();
var templatePlate = templateNest.PlateDefaults.CreateNew();
plate.Quadrant = templatePlate.Quadrant;
plate.Material = templatePlate.Material;
plate.EdgeSpacing = templatePlate.EdgeSpacing;
plate.PartSpacing = templatePlate.PartSpacing;
Console.WriteLine($"Template: {options.TemplateFile}");
+5 -16
View File
@@ -21,6 +21,7 @@ namespace OpenNest
Plates.ItemRemoved += Plates_PlateRemoved;
Drawings = new DrawingCollection();
PlateDefaults = new PlateSettings();
Material = new Material();
Customer = string.Empty;
Notes = string.Empty;
}
@@ -38,6 +39,10 @@ namespace OpenNest
public string AssistGas { get; set; } = "";
public double Thickness { get; set; }
public Material Material { get; set; }
public Units Units { get; set; }
public DateTime DateCreated { get; set; }
@@ -84,18 +89,6 @@ namespace OpenNest
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
{
get { return plate.Size; }
@@ -116,9 +109,7 @@ namespace OpenNest
public void SetFromExisting(Plate plate)
{
Thickness = plate.Thickness;
Quadrant = plate.Quadrant;
Material = plate.Material;
Size = plate.Size;
EdgeSpacing = plate.EdgeSpacing;
PartSpacing = plate.PartSpacing;
@@ -128,11 +119,9 @@ namespace OpenNest
{
return new Plate()
{
Thickness = Thickness,
Size = Size,
EdgeSpacing = EdgeSpacing,
PartSpacing = PartSpacing,
Material = Material,
Quadrant = Quadrant,
Quantity = 1
};
+4 -17
View File
@@ -43,7 +43,6 @@ namespace OpenNest
{
EdgeSpacing = new Spacing();
Size = size;
Material = new Material();
Parts = new ObservableList<Part>();
Parts.ItemAdded += Parts_PartAdded;
Parts.ItemRemoved += Parts_PartRemoved;
@@ -63,11 +62,6 @@ namespace OpenNest
e.Item.BaseDrawing.Quantity.Nested -= Quantity;
}
/// <summary>
/// Thickness of the plate.
/// </summary>
public double Thickness { get; set; }
/// <summary>
/// The spacing between parts.
/// </summary>
@@ -83,11 +77,6 @@ namespace OpenNest
/// </summary>
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; }
/// <summary>
@@ -571,19 +560,17 @@ namespace OpenNest
/// <summary>
/// Gets the volume of the plate.
/// </summary>
/// <returns></returns>
public double Volume()
public double Volume(double thickness)
{
return Area() * Thickness;
return Area() * thickness;
}
/// <summary>
/// Gets the weight of the plate.
/// </summary>
/// <returns></returns>
public double Weight()
public double Weight(double thickness, double density)
{
return Volume() * Material.Density;
return Volume(thickness) * density;
}
/// <summary>
+2 -2
View File
@@ -24,6 +24,8 @@ namespace OpenNest.IO
public string DateLastModified { get; init; } = "";
public string Notes { 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 List<DrawingDto> Drawings { get; init; } = new();
public List<PlateDto> Plates { get; init; } = new();
@@ -57,11 +59,9 @@ namespace OpenNest.IO
{
public int Id { get; init; }
public SizeDto Size { get; init; } = new();
public double Thickness { get; init; }
public int Quadrant { get; init; } = 1;
public int Quantity { get; init; } = 1;
public double PartSpacing { get; init; }
public MaterialDto Material { get; init; } = new();
public SpacingDto EdgeSpacing { get; init; } = new();
public double GrainAngle { get; init; }
public List<PartDto> Parts { get; init; } = new();
+6 -5
View File
@@ -180,13 +180,16 @@ namespace OpenNest.IO
nest.Notes = dto.Notes;
nest.AssistGas = dto.AssistGas ?? "";
// Plate defaults
// Nest-level material and thickness (fall back to PlateDefaults for old files)
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.Thickness = pd.Thickness;
nest.PlateDefaults.Quadrant = pd.Quadrant;
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);
// Drawings
@@ -198,11 +201,9 @@ namespace OpenNest.IO
{
var plate = new Plate();
plate.Size = new OpenNest.Geometry.Size(p.Size.Width, p.Size.Length);
plate.Thickness = p.Thickness;
plate.Quadrant = p.Quadrant;
plate.Quantity = p.Quantity;
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.GrainAngle = p.GrainAngle;
+11 -11
View File
@@ -79,6 +79,13 @@ namespace OpenNest.IO
DateLastModified = nest.DateLastModified.ToString("o"),
Notes = nest.Notes ?? "",
AssistGas = nest.AssistGas ?? "",
Thickness = nest.Thickness,
Material = new MaterialDto
{
Name = nest.Material.Name ?? "",
Grade = nest.Material.Grade ?? "",
Density = nest.Material.Density
},
PlateDefaults = BuildPlateDefaultsDto(),
Drawings = BuildDrawingDtos(),
Plates = BuildPlateDtos()
@@ -91,14 +98,14 @@ namespace OpenNest.IO
return new PlateDefaultsDto
{
Size = new SizeDto { Width = pd.Size.Width, Length = pd.Size.Length },
Thickness = pd.Thickness,
Thickness = nest.Thickness,
Quadrant = pd.Quadrant,
PartSpacing = pd.PartSpacing,
Material = new MaterialDto
{
Name = pd.Material.Name ?? "",
Grade = pd.Material.Grade ?? "",
Density = pd.Material.Density
Name = nest.Material.Name ?? "",
Grade = nest.Material.Grade ?? "",
Density = nest.Material.Density
},
EdgeSpacing = new SpacingDto
{
@@ -196,16 +203,9 @@ namespace OpenNest.IO
{
Id = i + 1,
Size = new SizeDto { Width = plate.Size.Width, Length = plate.Size.Length },
Thickness = plate.Thickness,
Quadrant = plate.Quadrant,
Quantity = plate.Quantity,
PartSpacing = plate.PartSpacing,
Material = new MaterialDto
{
Name = plate.Material.Name ?? "",
Grade = plate.Material.Grade ?? "",
Density = plate.Material.Density
},
EdgeSpacing = new SpacingDto
{
Left = plate.EdgeSpacing.Left,
+2 -2
View File
@@ -33,8 +33,8 @@ namespace OpenNest.Mcp.Tools
sb.AppendLine($"Plate {plateIndex}:");
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($" Thickness: {_session.Nest?.Thickness:F2}");
sb.AppendLine($" Material: {_session.Nest?.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.Length:F1}");
+2 -2
View File
@@ -31,8 +31,8 @@ namespace OpenNest.Mcp.Tools
plate.Quadrant = quadrant;
plate.Quantity = 1;
if (!string.IsNullOrEmpty(material))
plate.Material.Name = material;
if (!string.IsNullOrEmpty(material) && _session.Nest != null)
_session.Nest.Material = new Material(material);
_session.Plates.Add(plate);
@@ -75,11 +75,9 @@ namespace OpenNest.Posts.Cincinnati
var gas = MaterialLibraryResolver.ResolveGas(nest, Config);
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 initialCutLibrary = firstPlate != null
? resolver.ResolveCutLibrary(firstPlate.Material?.Name ?? "", firstPlate.Thickness, gas)
: "";
var initialCutLibrary = resolver.ResolveCutLibrary(nest.Material?.Name ?? "", nest.Thickness, gas);
// 4. Build part sub-program registry (if enabled)
Dictionary<(int, long), int> partSubprograms = null;
@@ -92,8 +90,8 @@ namespace OpenNest.Posts.Cincinnati
var preamble = new CincinnatiPreambleWriter(Config);
var sheetWriter = new CincinnatiSheetWriter(Config, vars);
// 6. Build material description from first plate
var material = firstPlate?.Material;
// 6. Build material description from nest
var material = nest.Material;
var materialDesc = material != null
? $"{material.Name}{(string.IsNullOrEmpty(material.Grade) ? "" : $", {material.Grade}")}"
: "";
@@ -113,7 +111,7 @@ namespace OpenNest.Posts.Cincinnati
var plate = plates[i];
var sheetIndex = i + 1;
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;
sheetWriter.Write(writer, plate, nest.Name ?? "NEST", sheetIndex, subNumber,
cutLibrary, etchLibrary, partSubprograms, isLastSheet);
@@ -2,7 +2,7 @@ using OpenNest.CNC;
using OpenNest.Engine.BestFit;
using OpenNest.Geometry;
namespace OpenNest.Tests;
namespace OpenNest.Tests.BestFit;
public class NfpBestFitIntegrationTests
{
@@ -4,7 +4,7 @@ using OpenNest.Engine.BestFit;
using OpenNest.Geometry;
using OpenNest.Math;
namespace OpenNest.Tests;
namespace OpenNest.Tests.BestFit;
public class NfpSlideStrategyTests
{
@@ -3,7 +3,7 @@ using System.Linq;
using OpenNest.CNC;
using OpenNest.Geometry;
namespace OpenNest.Tests;
namespace OpenNest.Tests.CutOffs;
public class CutOffGeometryTests
{
@@ -2,7 +2,7 @@ using OpenNest.CNC;
using OpenNest.Geometry;
using OpenNest.IO;
namespace OpenNest.Tests;
namespace OpenNest.Tests.CutOffs;
public class CutOffSerializationTests
{
@@ -2,7 +2,7 @@ using System.Linq;
using OpenNest.CNC;
using OpenNest.Geometry;
namespace OpenNest.Tests;
namespace OpenNest.Tests.CutOffs;
public class CutOffTests
{
@@ -26,11 +26,11 @@ public class CutOffTests
public void Plate_Utilization_ExcludesCutOffParts()
{
var pgm = new Program();
pgm.Codes.Add(new RapidMove(new Geometry.Vector(0, 0)));
pgm.Codes.Add(new LinearMove(new Geometry.Vector(10, 0)));
pgm.Codes.Add(new LinearMove(new Geometry.Vector(10, 10)));
pgm.Codes.Add(new LinearMove(new Geometry.Vector(0, 10)));
pgm.Codes.Add(new LinearMove(new Geometry.Vector(0, 0)));
pgm.Codes.Add(new RapidMove(new Vector(0, 0)));
pgm.Codes.Add(new LinearMove(new Vector(10, 0)));
pgm.Codes.Add(new LinearMove(new Vector(10, 10)));
pgm.Codes.Add(new LinearMove(new Vector(0, 10)));
pgm.Codes.Add(new LinearMove(new Vector(0, 0)));
var realDrawing = new Drawing("real", pgm);
var cutoffDrawing = new Drawing("cutoff", new Program()) { IsCutOff = true };
@@ -47,11 +47,11 @@ public class CutOffTests
public void Plate_HasOverlappingParts_SkipsCutOffParts()
{
var pgm = new Program();
pgm.Codes.Add(new RapidMove(new Geometry.Vector(0, 0)));
pgm.Codes.Add(new LinearMove(new Geometry.Vector(10, 0)));
pgm.Codes.Add(new LinearMove(new Geometry.Vector(10, 10)));
pgm.Codes.Add(new LinearMove(new Geometry.Vector(0, 10)));
pgm.Codes.Add(new LinearMove(new Geometry.Vector(0, 0)));
pgm.Codes.Add(new RapidMove(new Vector(0, 0)));
pgm.Codes.Add(new LinearMove(new Vector(10, 0)));
pgm.Codes.Add(new LinearMove(new Vector(10, 10)));
pgm.Codes.Add(new LinearMove(new Vector(0, 10)));
pgm.Codes.Add(new LinearMove(new Vector(0, 0)));
var realDrawing = new Drawing("real", pgm);
var cutoffDrawing = new Drawing("cutoff", pgm) { IsCutOff = true };
@@ -220,7 +220,7 @@ public class CutOffTests
public void Plate_RegenerateCutOffs_MaterializesParts()
{
var plate = new Plate(100, 50);
var cutoff = new CutOff(new Geometry.Vector(25, 10), CutOffAxis.Vertical);
var cutoff = new CutOff(new Vector(25, 10), CutOffAxis.Vertical);
plate.CutOffs.Add(cutoff);
plate.RegenerateCutOffs(new CutOffSettings());
@@ -233,7 +233,7 @@ public class CutOffTests
public void Plate_RegenerateCutOffs_ReplacesOldParts()
{
var plate = new Plate(100, 50);
var cutoff = new CutOff(new Geometry.Vector(25, 10), CutOffAxis.Vertical);
var cutoff = new CutOff(new Vector(25, 10), CutOffAxis.Vertical);
plate.CutOffs.Add(cutoff);
var settings = new CutOffSettings();
@@ -247,14 +247,14 @@ public class CutOffTests
public void Plate_RegenerateCutOffs_DoesNotAffectRegularParts()
{
var pgm = new OpenNest.CNC.Program();
pgm.Codes.Add(new OpenNest.CNC.RapidMove(new Geometry.Vector(0, 0)));
pgm.Codes.Add(new OpenNest.CNC.LinearMove(new Geometry.Vector(5, 5)));
pgm.Codes.Add(new OpenNest.CNC.RapidMove(new Vector(0, 0)));
pgm.Codes.Add(new OpenNest.CNC.LinearMove(new Vector(5, 5)));
var drawing = new Drawing("real", pgm);
var plate = new Plate(100, 50);
plate.Parts.Add(new Part(drawing));
var cutoff = new CutOff(new Geometry.Vector(25, 10), CutOffAxis.Vertical);
var cutoff = new CutOff(new Vector(25, 10), CutOffAxis.Vertical);
plate.CutOffs.Add(cutoff);
plate.RegenerateCutOffs(new CutOffSettings());
@@ -2,7 +2,7 @@ using OpenNest.CNC;
using OpenNest.CNC.CuttingStrategy;
using OpenNest.Geometry;
namespace OpenNest.Tests;
namespace OpenNest.Tests.CuttingStrategy;
public class CuttingResultTests
{
@@ -4,7 +4,7 @@ using OpenNest.Engine;
using OpenNest.Engine.Sequencing;
using OpenNest.Geometry;
namespace OpenNest.Tests;
namespace OpenNest.Tests.CuttingStrategy;
public class LeadInAssignerTests
{
@@ -2,7 +2,7 @@ using OpenNest.CNC;
using OpenNest.CNC.CuttingStrategy;
using OpenNest.Geometry;
namespace OpenNest.Tests;
namespace OpenNest.Tests.CuttingStrategy;
public class LeadInLayerTagTests
{
@@ -1,7 +1,7 @@
using OpenNest.CNC;
using OpenNest.Geometry;
namespace OpenNest.Tests;
namespace OpenNest.Tests.CuttingStrategy;
public class MotionSuppressedTests
{
@@ -2,7 +2,7 @@ using OpenNest.CNC;
using OpenNest.CNC.CuttingStrategy;
using OpenNest.Geometry;
namespace OpenNest.Tests;
namespace OpenNest.Tests.CuttingStrategy;
public class PartLeadInTests
{
@@ -3,7 +3,7 @@ using OpenNest.Geometry;
using OpenNest.IO;
using Xunit.Abstractions;
namespace OpenNest.Tests;
namespace OpenNest.Tests.Engine;
public class EngineOverlapTests
{
@@ -1,6 +1,6 @@
using OpenNest.Geometry;
namespace OpenNest.Tests;
namespace OpenNest.Tests.Engine;
public class EngineRefactorSmokeTests
{
@@ -1,4 +1,4 @@
namespace OpenNest.Tests;
namespace OpenNest.Tests.Engine;
public class NestPhaseExtensionsTests
{
@@ -1,6 +1,6 @@
using OpenNest.Geometry;
namespace OpenNest.Tests;
namespace OpenNest.Tests.Engine;
public class NestProgressTests
{
@@ -4,7 +4,7 @@ using OpenNest.Geometry;
using OpenNest.Math;
using OpenNest.Shapes;
namespace OpenNest.Tests;
namespace OpenNest.Tests.Engine;
public class PartClassifierTests
{
@@ -1,7 +1,7 @@
using OpenNest.CNC;
using OpenNest.Geometry;
namespace OpenNest.Tests;
namespace OpenNest.Tests.Engine;
public class PartFlagTests
{
@@ -3,7 +3,7 @@ using OpenNest.Engine;
using OpenNest.Engine.RapidPlanning;
using OpenNest.Engine.Sequencing;
namespace OpenNest.Tests;
namespace OpenNest.Tests.Engine;
public class PlateProcessorTests
{
@@ -2,7 +2,7 @@ using OpenNest.Engine;
using OpenNest.Engine.Fill;
using OpenNest.Geometry;
namespace OpenNest.Tests;
namespace OpenNest.Tests.Engine;
public class RemnantEngineTests
{
@@ -1,6 +1,6 @@
using OpenNest.Engine.Fill;
namespace OpenNest.Tests;
namespace OpenNest.Tests.Fill;
public class AccumulatingProgressTests
{
@@ -3,7 +3,7 @@ using OpenNest.Engine.Fill;
using OpenNest.Geometry;
using OpenNest.Math;
namespace OpenNest.Tests;
namespace OpenNest.Tests.Fill;
public class AngleCandidateBuilderTests
{
@@ -1,4 +1,4 @@
namespace OpenNest.Tests;
namespace OpenNest.Tests.Fill;
public class BestCombinationTests
{
@@ -4,7 +4,7 @@ using OpenNest.Geometry;
using Xunit;
using System.Collections.Generic;
namespace OpenNest.Tests
namespace OpenNest.Tests.Fill
{
public class CompactorTests
{
@@ -2,7 +2,7 @@ using OpenNest.Engine;
using OpenNest.Engine.Fill;
using OpenNest.Geometry;
namespace OpenNest.Tests;
namespace OpenNest.Tests.Fill;
public class DefaultFillComparerTests
{
@@ -2,7 +2,7 @@ using OpenNest.CNC;
using OpenNest.Engine.Fill;
using OpenNest.Geometry;
namespace OpenNest.Tests;
namespace OpenNest.Tests.Fill;
public class FillExtentsTests
{
@@ -3,7 +3,7 @@ using OpenNest.Engine.Fill;
using OpenNest.Engine.Strategies;
using OpenNest.Geometry;
namespace OpenNest.Tests;
namespace OpenNest.Tests.Fill;
public class FillWithDirectionPreferenceTests
{
@@ -1,6 +1,7 @@
using OpenNest.Geometry;
using OpenNest.Engine.Fill;
namespace OpenNest.Tests;
namespace OpenNest.Tests.Fill;
public class FillScoreTests
{
@@ -48,7 +49,7 @@ public class FillScoreTests
[Fact]
public void Compute_NullParts_ReturnsDefault()
{
var score = FillScore.Compute(null, new Geometry.Box(0, 0, 100, 100));
var score = FillScore.Compute(null, new Box(0, 0, 100, 100));
Assert.Equal(0, score.Count);
}
@@ -56,7 +57,7 @@ public class FillScoreTests
[Fact]
public void Compute_EmptyParts_ReturnsDefault()
{
var score = FillScore.Compute(new System.Collections.Generic.List<Part>(), new Geometry.Box(0, 0, 100, 100));
var score = FillScore.Compute(new System.Collections.Generic.List<Part>(), new Box(0, 0, 100, 100));
Assert.Equal(0, score.Count);
}
@@ -70,7 +71,7 @@ public class FillScoreTests
TestHelpers.MakePartAt(20, 0, 10),
TestHelpers.MakePartAt(40, 0, 10)
};
var score = FillScore.Compute(parts, new Geometry.Box(0, 0, 100, 100));
var score = FillScore.Compute(parts, new Box(0, 0, 100, 100));
Assert.Equal(3, score.Count);
Assert.True(score.Density > 0);
@@ -1,7 +1,7 @@
using OpenNest.Engine.Fill;
using OpenNest.Geometry;
namespace OpenNest.Tests;
namespace OpenNest.Tests.Fill;
public class IterativeShrinkFillerTests
{
@@ -1,7 +1,7 @@
using OpenNest.Engine.Fill;
using OpenNest.Geometry;
namespace OpenNest.Tests;
namespace OpenNest.Tests.Fill;
public class PairFillerTests
{
@@ -4,7 +4,7 @@ using OpenNest.Geometry;
using OpenNest.Math;
using Xunit.Abstractions;
namespace OpenNest.Tests;
namespace OpenNest.Tests.Fill;
public class PairOverlapDiagnosticTests
{
@@ -1,7 +1,7 @@
using OpenNest.Engine.Fill;
using OpenNest.Geometry;
namespace OpenNest.Tests;
namespace OpenNest.Tests.Fill;
public class PatternTilerTests
{
@@ -1,7 +1,7 @@
using OpenNest.Engine.Fill;
using OpenNest.Geometry;
namespace OpenNest.Tests;
namespace OpenNest.Tests.Fill;
public class RemnantFillerTests2
{
@@ -2,7 +2,7 @@ using OpenNest.Engine.Fill;
using OpenNest.Geometry;
using OpenNest.IO;
namespace OpenNest.Tests;
namespace OpenNest.Tests.Fill;
public class RemnantFinderTests
{
@@ -1,7 +1,7 @@
using OpenNest.Engine.Fill;
using OpenNest.Geometry;
namespace OpenNest.Tests;
namespace OpenNest.Tests.Fill;
public class ShrinkFillerTests
{
@@ -2,7 +2,7 @@ using OpenNest.Geometry;
using OpenNest.Math;
using System.Collections.Generic;
namespace OpenNest.Tests;
namespace OpenNest.Tests.Geometry;
public class CollisionTests
{
@@ -1,7 +1,7 @@
using OpenNest.Converters;
using OpenNest.Geometry;
namespace OpenNest.Tests;
namespace OpenNest.Tests.Geometry;
public class ContourClassificationTests
{
@@ -3,7 +3,7 @@ using OpenNest.Math;
using Xunit;
using System.Linq;
namespace OpenNest.Tests;
namespace OpenNest.Tests.Geometry;
public class EllipseConverterTests
{
@@ -4,7 +4,7 @@ using System.IO;
using System.Linq;
using Xunit;
namespace OpenNest.Tests;
namespace OpenNest.Tests.Geometry;
public class GeometrySimplifierTests
{
@@ -1,6 +1,6 @@
using OpenNest.Geometry;
namespace OpenNest.Tests;
namespace OpenNest.Tests.Geometry;
public class PolyLabelTests
{
@@ -3,7 +3,7 @@ using OpenNest.Engine.BestFit;
using OpenNest.Geometry;
using OpenNest.Math;
namespace OpenNest.Tests;
namespace OpenNest.Tests.Geometry;
public class PolygonHelperTests
{
@@ -2,7 +2,7 @@ using OpenNest.Geometry;
using OpenNest.Math;
using Xunit;
namespace OpenNest.Tests;
namespace OpenNest.Tests.Geometry;
public class SplineConverterTests
{
@@ -2,7 +2,7 @@ using OpenNest.Converters;
using OpenNest.Geometry;
using OpenNest.IO;
namespace OpenNest.Tests;
namespace OpenNest.Tests.IO;
public class DxfRoundtripTests
{
@@ -3,7 +3,7 @@ using OpenNest.Geometry;
using OpenNest.IO;
using System.Linq;
namespace OpenNest.Tests;
namespace OpenNest.Tests.IO;
public class NestBendSerializationTests
{
@@ -6,7 +6,7 @@ using OpenNest.Geometry;
using OpenNest.IO;
using Xunit.Abstractions;
namespace OpenNest.Tests;
namespace OpenNest.Tests.Strategies;
public class StrategyOverlapTests
{
+5 -2
View File
@@ -7,6 +7,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Windows.Forms;
namespace OpenNest.Actions
@@ -341,8 +342,10 @@ namespace OpenNest.Actions
cleanProgram = selectedPart.Program;
}
var entities = ConvertProgram.ToGeometry(cleanProgram);
entities.RemoveAll(e => e.Layer == SpecialLayers.Scribe);
var entities = ConvertProgram.ToGeometry(cleanProgram)
.Where(e => e.Layer == SpecialLayers.Cut)
.ToList();
profile = new ShapeProfile(entities);
contours = new List<ShapeInfo>();
+40 -12
View File
@@ -16,7 +16,7 @@ namespace OpenNest.Controls
private readonly CollapsiblePanel bendLinesPanel;
private readonly CheckedListBox layersList;
private readonly CheckedListBox colorsList;
private readonly ListBox colorsList;
private readonly CheckedListBox lineTypesList;
private readonly ListBox bendLinesList;
private readonly LinkLabel bendAddLink;
@@ -91,7 +91,7 @@ namespace OpenNest.Controls
HeaderText = "Line Types (0)",
Dock = DockStyle.Top,
ExpandedHeight = 100,
IsExpanded = false
IsExpanded = true
};
lineTypesList = CreateCheckedList();
lineTypesPanel.ContentPanel.Controls.Add(lineTypesList);
@@ -102,12 +102,19 @@ namespace OpenNest.Controls
HeaderText = "Colors (0)",
Dock = DockStyle.Top,
ExpandedHeight = 100,
IsExpanded = false
IsExpanded = true
};
colorsList = new ListBox
{
Dock = DockStyle.Fill,
BorderStyle = BorderStyle.None,
Font = new Font("Segoe UI", 9f),
DrawMode = DrawMode.OwnerDrawFixed,
ItemHeight = 20,
SelectionMode = SelectionMode.None
};
colorsList = CreateCheckedList();
colorsList.DrawMode = DrawMode.OwnerDrawFixed;
colorsList.ItemHeight = 20;
colorsList.DrawItem += ColorsList_DrawItem;
colorsList.MouseClick += ColorsList_MouseClick;
colorsPanel.ContentPanel.Controls.Add(colorsList);
// Layers (always expanded)
@@ -174,7 +181,7 @@ namespace OpenNest.Controls
.Distinct()
.Select(argb => new ColorItem(Color.FromArgb(argb)));
foreach (var color in colors)
colorsList.Items.Add(color, true); // checked = visible
colorsList.Items.Add(color);
colorsPanel.HeaderText = $"Colors ({colorsList.Items.Count})";
@@ -213,8 +220,9 @@ namespace OpenNest.Controls
var hiddenColors = new HashSet<int>();
for (var i = 0; i < colorsList.Items.Count; i++)
{
if (!colorsList.GetItemChecked(i))
hiddenColors.Add(((ColorItem)colorsList.Items[i]).Argb);
var item = (ColorItem)colorsList.Items[i];
if (!item.IsChecked)
hiddenColors.Add(item.Argb);
}
var hiddenLineTypes = new HashSet<string>();
@@ -242,20 +250,39 @@ namespace OpenNest.Controls
list.SetItemChecked(i, isChecked);
}
private void ColorsList_MouseClick(object sender, MouseEventArgs e)
{
var index = colorsList.IndexFromPoint(e.Location);
if (index < 0) return;
var item = (ColorItem)colorsList.Items[index];
item.IsChecked = !item.IsChecked;
colorsList.Invalidate(colorsList.GetItemRectangle(index));
FilterChanged?.Invoke(this, EventArgs.Empty);
}
private void ColorsList_DrawItem(object sender, DrawItemEventArgs e)
{
if (e.Index < 0) return;
e.DrawBackground();
e.Graphics.FillRectangle(Brushes.White, e.Bounds);
var colorItem = (ColorItem)colorsList.Items[e.Index];
var swatchRect = new Rectangle(e.Bounds.Left + 20, e.Bounds.Top + 2, 16, e.Bounds.Height - 4);
var checkSize = CheckBoxRenderer.GetGlyphSize(e.Graphics,
System.Windows.Forms.VisualStyles.CheckBoxState.CheckedNormal);
var checkY = e.Bounds.Top + (e.Bounds.Height - checkSize.Height) / 2;
var checkState = colorItem.IsChecked
? System.Windows.Forms.VisualStyles.CheckBoxState.CheckedNormal
: System.Windows.Forms.VisualStyles.CheckBoxState.UncheckedNormal;
CheckBoxRenderer.DrawCheckBox(e.Graphics, new Point(e.Bounds.Left + 2, checkY), checkState);
var swatchX = e.Bounds.Left + checkSize.Width + 6;
var swatchRect = new Rectangle(swatchX, e.Bounds.Top + 2, 16, e.Bounds.Height - 4);
using (var brush = new SolidBrush(colorItem.Color))
e.Graphics.FillRectangle(brush, swatchRect);
e.Graphics.DrawRectangle(Pens.Gray, swatchRect);
e.DrawFocusRectangle();
TextRenderer.DrawText(e.Graphics, colorItem.ToString(), e.Font,
new Point(swatchRect.Right + 4, e.Bounds.Top + 1), SystemColors.WindowText);
}
public void SetPickMode(bool active)
@@ -269,6 +296,7 @@ namespace OpenNest.Controls
{
public int Argb { get; }
public Color Color { get; }
public bool IsChecked { get; set; } = true;
public ColorItem(Color color)
{
-2
View File
@@ -782,8 +782,6 @@ namespace OpenNest.Controls
{
Quadrant = Plate.Quadrant,
PartSpacing = Plate.PartSpacing,
Thickness = Plate.Thickness,
Material = Plate.Material,
};
previewPlate.EdgeSpacing = Plate.EdgeSpacing;
progressForm.PreviewPlate = previewPlate;
+19 -22
View File
@@ -50,14 +50,6 @@ namespace OpenNest.Controls
contours = ContourInfo.Classify(shapes);
// Assign contour-type colors once so the CAD view also picks them up
foreach (var contour in contours)
{
var color = GetContourColor(contour.Type, false);
foreach (var entity in contour.Shape.Entities)
entity.Color = color;
}
Program = BuildProgram(contours);
isDirty = false;
isLoaded = true;
@@ -144,33 +136,38 @@ namespace OpenNest.Controls
preview.ClearPenCache();
preview.Entities.Clear();
// Restore base colors first (undo any selection highlight)
foreach (var contour in contours)
{
var baseColor = GetContourColor(contour.Type, false);
foreach (var entity in contour.Shape.Entities)
entity.Color = baseColor;
}
for (var i = 0; i < contours.Count; i++)
{
var contour = contours[i];
var selected = contourList.SelectedIndices.Contains(i);
var color = GetContourColor(contour.Type, selected);
if (selected)
{
var selColor = GetContourColor(contour.Type, true);
foreach (var entity in contour.Shape.Entities)
entity.Color = selColor;
{
var clone = CloneEntity(entity, color);
if (clone != null)
preview.Entities.Add(clone);
}
preview.Entities.AddRange(contour.Shape.Entities);
}
preview.ZoomToFit();
preview.Invalidate();
}
private static Entity CloneEntity(Entity entity, Color color)
{
Entity clone = entity switch
{
Line line => new Line(line.StartPoint, line.EndPoint) { Layer = line.Layer, IsVisible = line.IsVisible },
Arc arc => new Arc(arc.Center, arc.Radius, arc.StartAngle, arc.EndAngle, arc.IsReversed) { Layer = arc.Layer, IsVisible = arc.IsVisible },
Circle circle => new Circle(circle.Center, circle.Radius) { Layer = circle.Layer, IsVisible = circle.IsVisible },
_ => null,
};
if (clone != null)
clone.Color = color;
return clone;
}
private static Color GetContourColor(ContourClassification type, bool selected)
{
if (selected)
+2 -2
View File
@@ -400,8 +400,8 @@ namespace OpenNest.Forms
nest.DateCreated = DateTime.Now;
nest.DateLastModified = DateTime.Now;
nest.PlateDefaults.Size = new Geometry.Size(plateWidth, plateLength);
nest.PlateDefaults.Thickness = thickness;
nest.PlateDefaults.Material = new Material(material);
nest.Thickness = thickness;
nest.Material = new Material(material);
nest.PlateDefaults.Quadrant = 1;
nest.PlateDefaults.PartSpacing = 1;
nest.PlateDefaults.EdgeSpacing = new Spacing(1, 1, 1, 1);
+53 -53
View File
@@ -17,14 +17,12 @@ namespace OpenNest.Forms
{
mainSplit = new System.Windows.Forms.SplitContainer();
fileList = new OpenNest.Controls.FileListControl();
viewTabs = new System.Windows.Forms.TabControl();
tabCadView = new System.Windows.Forms.TabPage();
cadViewSplit = new System.Windows.Forms.SplitContainer();
filterPanel = new OpenNest.Controls.FilterPanel();
entityView1 = new OpenNest.Controls.EntityView();
detailBar = new System.Windows.Forms.FlowLayoutPanel();
viewTabs = new System.Windows.Forms.TabControl();
tabCadView = new System.Windows.Forms.TabPage();
tabProgram = new System.Windows.Forms.TabPage();
programEditor = new OpenNest.Controls.ProgramEditorControl();
lblQty = new System.Windows.Forms.Label();
numQuantity = new System.Windows.Forms.NumericUpDown();
lblCust = new System.Windows.Forms.Label();
@@ -38,6 +36,8 @@ namespace OpenNest.Forms
chkLabels = new System.Windows.Forms.CheckBox();
lblDetect = new System.Windows.Forms.Label();
cboBendDetector = new System.Windows.Forms.ComboBox();
tabProgram = new System.Windows.Forms.TabPage();
programEditor = new OpenNest.Controls.ProgramEditorControl();
bottomPanel1 = new OpenNest.Controls.BottomPanel();
cancelButton = new System.Windows.Forms.Button();
acceptButton = new System.Windows.Forms.Button();
@@ -45,15 +45,15 @@ namespace OpenNest.Forms
mainSplit.Panel1.SuspendLayout();
mainSplit.Panel2.SuspendLayout();
mainSplit.SuspendLayout();
viewTabs.SuspendLayout();
tabCadView.SuspendLayout();
((System.ComponentModel.ISupportInitialize)cadViewSplit).BeginInit();
cadViewSplit.Panel1.SuspendLayout();
cadViewSplit.Panel2.SuspendLayout();
cadViewSplit.SuspendLayout();
detailBar.SuspendLayout();
viewTabs.SuspendLayout();
tabCadView.SuspendLayout();
tabProgram.SuspendLayout();
((System.ComponentModel.ISupportInitialize)numQuantity).BeginInit();
tabProgram.SuspendLayout();
bottomPanel1.SuspendLayout();
SuspendLayout();
//
@@ -88,6 +88,27 @@ namespace OpenNest.Forms
fileList.Size = new System.Drawing.Size(260, 670);
fileList.TabIndex = 0;
//
// viewTabs
//
viewTabs.Controls.Add(tabCadView);
viewTabs.Controls.Add(tabProgram);
viewTabs.Dock = System.Windows.Forms.DockStyle.Fill;
viewTabs.Location = new System.Drawing.Point(0, 0);
viewTabs.Name = "viewTabs";
viewTabs.SelectedIndex = 0;
viewTabs.Size = new System.Drawing.Size(759, 670);
viewTabs.TabIndex = 0;
//
// tabCadView
//
tabCadView.Controls.Add(cadViewSplit);
tabCadView.Location = new System.Drawing.Point(4, 24);
tabCadView.Name = "tabCadView";
tabCadView.Size = new System.Drawing.Size(751, 642);
tabCadView.TabIndex = 0;
tabCadView.Text = "CAD View";
tabCadView.UseVisualStyleBackColor = true;
//
// cadViewSplit
//
cadViewSplit.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -95,12 +116,12 @@ namespace OpenNest.Forms
cadViewSplit.Location = new System.Drawing.Point(0, 0);
cadViewSplit.Name = "cadViewSplit";
//
// cadViewSplit.Panel1 — filter panel
// cadViewSplit.Panel1
//
cadViewSplit.Panel1.Controls.Add(filterPanel);
cadViewSplit.Panel1MinSize = 150;
//
// cadViewSplit.Panel2 — entity view + detail bar
// cadViewSplit.Panel2
//
cadViewSplit.Panel2.Controls.Add(entityView1);
cadViewSplit.Panel2.Controls.Add(detailBar);
@@ -118,6 +139,7 @@ namespace OpenNest.Forms
filterPanel.Name = "filterPanel";
filterPanel.Size = new System.Drawing.Size(200, 642);
filterPanel.TabIndex = 0;
filterPanel.Paint += filterPanel_Paint;
//
// entityView1
//
@@ -128,6 +150,7 @@ namespace OpenNest.Forms
entityView1.Location = new System.Drawing.Point(0, 0);
entityView1.Name = "entityView1";
entityView1.OriginalEntities = null;
entityView1.PaintOverlay = null;
entityView1.ShowEntityLabels = false;
entityView1.SimplifierHighlight = null;
entityView1.SimplifierPreview = null;
@@ -153,7 +176,7 @@ namespace OpenNest.Forms
detailBar.Controls.Add(lblDetect);
detailBar.Controls.Add(cboBendDetector);
detailBar.Dock = System.Windows.Forms.DockStyle.Bottom;
detailBar.Location = new System.Drawing.Point(0, 634);
detailBar.Location = new System.Drawing.Point(0, 606);
detailBar.Name = "detailBar";
detailBar.Padding = new System.Windows.Forms.Padding(4, 6, 4, 4);
detailBar.Size = new System.Drawing.Size(546, 36);
@@ -308,6 +331,24 @@ namespace OpenNest.Forms
cboBendDetector.Size = new System.Drawing.Size(90, 23);
cboBendDetector.TabIndex = 8;
//
// tabProgram
//
tabProgram.Controls.Add(programEditor);
tabProgram.Location = new System.Drawing.Point(4, 24);
tabProgram.Name = "tabProgram";
tabProgram.Size = new System.Drawing.Size(751, 642);
tabProgram.TabIndex = 1;
tabProgram.Text = "Program";
tabProgram.UseVisualStyleBackColor = true;
//
// programEditor
//
programEditor.Dock = System.Windows.Forms.DockStyle.Fill;
programEditor.Location = new System.Drawing.Point(0, 0);
programEditor.Name = "programEditor";
programEditor.Size = new System.Drawing.Size(751, 642);
programEditor.TabIndex = 0;
//
// bottomPanel1
//
bottomPanel1.Controls.Add(cancelButton);
@@ -342,47 +383,6 @@ namespace OpenNest.Forms
acceptButton.TabIndex = 1;
acceptButton.Text = "Accept";
//
// viewTabs
//
viewTabs.Controls.Add(tabCadView);
viewTabs.Controls.Add(tabProgram);
viewTabs.Dock = System.Windows.Forms.DockStyle.Fill;
viewTabs.Location = new System.Drawing.Point(0, 0);
viewTabs.Name = "viewTabs";
viewTabs.SelectedIndex = 0;
viewTabs.Size = new System.Drawing.Size(759, 670);
viewTabs.TabIndex = 0;
//
// tabCadView
//
tabCadView.Controls.Add(cadViewSplit);
tabCadView.Location = new System.Drawing.Point(4, 24);
tabCadView.Name = "tabCadView";
tabCadView.Padding = new System.Windows.Forms.Padding(0);
tabCadView.Size = new System.Drawing.Size(751, 642);
tabCadView.TabIndex = 0;
tabCadView.Text = "CAD View";
tabCadView.UseVisualStyleBackColor = true;
//
// tabProgram
//
tabProgram.Controls.Add(programEditor);
tabProgram.Location = new System.Drawing.Point(4, 24);
tabProgram.Name = "tabProgram";
tabProgram.Padding = new System.Windows.Forms.Padding(0);
tabProgram.Size = new System.Drawing.Size(751, 642);
tabProgram.TabIndex = 1;
tabProgram.Text = "Program";
tabProgram.UseVisualStyleBackColor = true;
//
// programEditor
//
programEditor.Dock = System.Windows.Forms.DockStyle.Fill;
programEditor.Location = new System.Drawing.Point(0, 0);
programEditor.Name = "programEditor";
programEditor.Size = new System.Drawing.Size(751, 642);
programEditor.TabIndex = 0;
//
// CadConverterForm
//
AllowDrop = true;
@@ -402,6 +402,8 @@ namespace OpenNest.Forms
mainSplit.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)mainSplit).EndInit();
mainSplit.ResumeLayout(false);
viewTabs.ResumeLayout(false);
tabCadView.ResumeLayout(false);
cadViewSplit.Panel1.ResumeLayout(false);
cadViewSplit.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)cadViewSplit).EndInit();
@@ -409,8 +411,6 @@ namespace OpenNest.Forms
detailBar.ResumeLayout(false);
detailBar.PerformLayout();
((System.ComponentModel.ISupportInitialize)numQuantity).EndInit();
viewTabs.ResumeLayout(false);
tabCadView.ResumeLayout(false);
tabProgram.ResumeLayout(false);
bottomPanel1.ResumeLayout(false);
ResumeLayout(false);
+5 -30
View File
@@ -161,8 +161,6 @@ namespace OpenNest.Forms
item.Entities.ForEach(e => e.Layer.IsVisible = true);
ReHidePromotedEntities(item.Bends);
ApplyContourColors(item.Entities);
filterPanel.LoadItem(item.Entities, item.Bends);
numQuantity.Value = item.Quantity;
@@ -178,30 +176,6 @@ namespace OpenNest.Forms
CheckSimplifiable(item);
}
private static void ApplyContourColors(List<Entity> entities)
{
var visible = entities.Where(e => e.IsVisible && e.Layer != null && e.Layer.IsVisible).ToList();
if (visible.Count == 0) return;
var shapes = ShapeBuilder.GetShapes(visible);
if (shapes.Count == 0) return;
var contours = ContourInfo.Classify(shapes);
foreach (var contour in contours)
{
var color = contour.Type switch
{
ContourClassification.Perimeter => System.Drawing.Color.FromArgb(80, 180, 120),
ContourClassification.Hole => System.Drawing.Color.FromArgb(100, 140, 255),
ContourClassification.Etch => System.Drawing.Color.FromArgb(255, 170, 50),
ContourClassification.Open => System.Drawing.Color.FromArgb(200, 200, 100),
_ => System.Drawing.Color.Gray,
};
foreach (var entity in contour.Shape.Entities)
entity.Color = color;
}
}
private void CheckSimplifiable(FileListItem item)
{
ResetSimplifyButton();
@@ -293,10 +267,6 @@ namespace OpenNest.Forms
var normalized = ShapeProfile.NormalizeEntities(entities);
programEditor.LoadEntities(normalized);
staleProgram = false;
// Refresh CAD view to show contour-type colors
entityView1.ClearPenCache();
entityView1.Invalidate();
}
private void OnBendLineSelected(object sender, int index)
@@ -728,5 +698,10 @@ namespace OpenNest.Forms
}
#endregion
private void filterPanel_Paint(object sender, PaintEventArgs e)
{
}
}
}
+37 -12
View File
@@ -62,6 +62,8 @@
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
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.tabPage3 = new System.Windows.Forms.TabPage();
this.notesBox = new System.Windows.Forms.TextBox();
@@ -401,28 +403,31 @@
this.tableLayoutPanel3.ColumnCount = 2;
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.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.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.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.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.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.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 6;
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, 16.66667F));
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, 16.66667F));
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, 16.66667F));
this.tableLayoutPanel3.Size = new System.Drawing.Size(362, 240);
this.tableLayoutPanel3.RowCount = 7;
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, 14.28571F));
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, 14.28571F));
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, 14.28571F));
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;
//
// tableLayoutPanel4
@@ -498,6 +503,24 @@
this.thicknessBox.Suffix = "";
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
//
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 radioButton2;
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; }
}
public string MaterialName
{
get { return materialBox.Text; }
set { materialBox.Text = value; }
}
public void SetUnits(Units units)
{
switch (units)
@@ -189,7 +195,8 @@ namespace OpenNest.Forms
Customer = nest.Customer;
DateCreated = nest.DateCreated;
DateLastModified = nest.DateLastModified;
Thickness = nest.PlateDefaults.Thickness;
Thickness = nest.Thickness;
MaterialName = nest.Material?.Name ?? "";
SizeString = nest.PlateDefaults.Size.ToString();
PartSpacing = nest.PlateDefaults.PartSpacing;
LeftSpacing = nest.PlateDefaults.EdgeSpacing.Left;
@@ -209,7 +216,8 @@ namespace OpenNest.Forms
nest.Customer = Customer;
nest.DateCreated = DateCreated;
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.PartSpacing = PartSpacing;
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.labelSize = new System.Windows.Forms.Label();
this.textBoxSize = new System.Windows.Forms.TextBox();
this.labelThk = new System.Windows.Forms.Label();
this.labelPartSpacing = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
@@ -50,7 +49,6 @@
this.numericUpDownEdgeSpacingRight = new OpenNest.Controls.NumericUpDown();
this.numericUpDownEdgeSpacingBottom = new OpenNest.Controls.NumericUpDown();
this.numericUpDownQty = new OpenNest.Controls.NumericUpDown();
this.numericUpDownThickness = new OpenNest.Controls.NumericUpDown();
this.numericUpDownPartSpacing = new OpenNest.Controls.NumericUpDown();
this.tableLayoutPanel1.SuspendLayout();
this.groupBox1.SuspendLayout();
@@ -62,7 +60,6 @@
((System.ComponentModel.ISupportInitialize)(this.numericUpDownEdgeSpacingRight)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownEdgeSpacingBottom)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownQty)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownThickness)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownPartSpacing)).BeginInit();
this.SuspendLayout();
//
@@ -75,18 +72,15 @@
this.tableLayoutPanel1.Controls.Add(this.labelSize, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.textBoxSize, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.numericUpDownQty, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.numericUpDownThickness, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.labelThk, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.labelPartSpacing, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.numericUpDownPartSpacing, 1, 3);
this.tableLayoutPanel1.Controls.Add(this.labelPartSpacing, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.numericUpDownPartSpacing, 1, 2);
this.tableLayoutPanel1.Location = new System.Drawing.Point(18, 12);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 4;
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, 25F));
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, 25F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(236, 144);
this.tableLayoutPanel1.RowCount = 3;
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, 33.33333F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(236, 108);
this.tableLayoutPanel1.TabIndex = 0;
//
// labelQty
@@ -120,17 +114,6 @@
this.textBoxSize.TabIndex = 1;
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
//
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.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
//
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.numericUpDownEdgeSpacingBottom)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownQty)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownThickness)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownPartSpacing)).EndInit();
this.ResumeLayout(false);
@@ -441,8 +408,6 @@
private Controls.NumericUpDown numericUpDownQty;
private Controls.QuadrantSelect quadrantSelect1;
private System.Windows.Forms.GroupBox groupBox2;
private Controls.NumericUpDown numericUpDownThickness;
private System.Windows.Forms.Label labelThk;
private System.Windows.Forms.Label labelPartSpacing;
private Controls.NumericUpDown numericUpDownPartSpacing;
private Controls.BottomPanel bottomPanel1;
-9
View File
@@ -58,7 +58,6 @@ namespace OpenNest.Forms
var controls = new[]
{
numericUpDownThickness,
numericUpDownPartSpacing,
numericUpDownEdgeSpacingBottom,
numericUpDownEdgeSpacingLeft,
@@ -110,12 +109,6 @@ namespace OpenNest.Forms
set { numericUpDownPartSpacing.Value = (decimal)value; }
}
public double Thickness
{
get { return (double)numericUpDownThickness.Value; }
set { numericUpDownThickness.Value = (decimal)value; }
}
public int Quantity
{
get { return (int)numericUpDownQty.Value; }
@@ -163,7 +156,6 @@ namespace OpenNest.Forms
PartSpacing = plate.PartSpacing;
Quantity = plate.Quantity;
Quadrant = plate.Quadrant;
Thickness = plate.Thickness;
}
private void Save()
@@ -176,7 +168,6 @@ namespace OpenNest.Forms
plate.PartSpacing = PartSpacing;
plate.Quantity = Quantity;
plate.Quadrant = Quadrant;
plate.Thickness = Thickness;
}
private void textBox1_TextChanged(object sender, EventArgs e)
-2
View File
@@ -1017,8 +1017,6 @@ namespace OpenNest.Forms
{
Quadrant = source.Quadrant,
PartSpacing = source.PartSpacing,
Thickness = source.Thickness,
Material = source.Material,
};
plate.EdgeSpacing = source.EdgeSpacing;
return plate;
-18
View File
@@ -15,13 +15,10 @@ namespace OpenNest.Forms
{
ColorScheme colorScheme1 = new ColorScheme();
Plate plate1 = new Plate();
Material material1 = new Material();
Collections.ObservableList<Part> observableList_11 = new Collections.ObservableList<Part>();
Plate plate2 = new Plate();
Material material2 = new Material();
Collections.ObservableList<Part> observableList_12 = new Collections.ObservableList<Part>();
Plate plate3 = new Plate();
Material material3 = new Material();
Collections.ObservableList<Part> observableList_13 = new Collections.ObservableList<Part>();
topPanel = new System.Windows.Forms.FlowLayoutPanel();
lblDrawingA = new System.Windows.Forms.Label();
@@ -218,15 +215,10 @@ namespace OpenNest.Forms
cellView.Name = "cellView";
cellView.OffsetIncrementDistance = 10D;
cellView.OffsetTolerance = 0.001D;
material1.Density = 0D;
material1.Grade = null;
material1.Name = null;
plate1.Material = material1;
plate1.Parts = observableList_11;
plate1.PartSpacing = 0D;
plate1.Quadrant = 1;
plate1.Quantity = 0;
plate1.Thickness = 0D;
cellView.Plate = plate1;
cellView.RotateIncrementAngle = 10D;
cellView.Size = new System.Drawing.Size(610, 677);
@@ -274,15 +266,10 @@ namespace OpenNest.Forms
hPreview.Name = "hPreview";
hPreview.OffsetIncrementDistance = 10D;
hPreview.OffsetTolerance = 0.001D;
material2.Density = 0D;
material2.Grade = null;
material2.Name = null;
plate2.Material = material2;
plate2.Parts = observableList_12;
plate2.PartSpacing = 0D;
plate2.Quadrant = 1;
plate2.Quantity = 0;
plate2.Thickness = 0D;
hPreview.Plate = plate2;
hPreview.RotateIncrementAngle = 10D;
hPreview.Size = new System.Drawing.Size(605, 313);
@@ -322,15 +309,10 @@ namespace OpenNest.Forms
vPreview.Name = "vPreview";
vPreview.OffsetIncrementDistance = 10D;
vPreview.OffsetTolerance = 0.001D;
material3.Density = 0D;
material3.Grade = null;
material3.Name = null;
plate3.Material = material3;
plate3.Parts = observableList_13;
plate3.PartSpacing = 0D;
plate3.Quadrant = 1;
plate3.Quantity = 0;
plate3.Thickness = 0D;
vPreview.Plate = plate3;
vPreview.RotateIncrementAngle = 10D;
vPreview.Size = new System.Drawing.Size(605, 320);
+1 -1
View File
@@ -474,7 +474,7 @@ public partial class SplitDrawingForm : Form
}
// Placement preview line
if (_placingLine && _placingCursor != null)
if (_placingLine)
{
var isVert = _currentAxis == CutOffAxis.Vertical;
var snapped = _placingCursor;