Compare commits
4
Commits
9f76659d5d
...
97d897e885
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
97d897e885 | ||
|
|
9db7abcd37 | ||
|
|
3e340e67e0 | ||
|
|
7a6c407edd |
@@ -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
|
||||||
|
|||||||
@@ -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
@@ -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
@@ -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>
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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
@@ -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,
|
||||||
|
|||||||
@@ -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}");
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ using OpenNest.CNC;
|
|||||||
using OpenNest.Engine.BestFit;
|
using OpenNest.Engine.BestFit;
|
||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.BestFit;
|
||||||
|
|
||||||
public class NfpBestFitIntegrationTests
|
public class NfpBestFitIntegrationTests
|
||||||
{
|
{
|
||||||
+1
-1
@@ -4,7 +4,7 @@ using OpenNest.Engine.BestFit;
|
|||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
using OpenNest.Math;
|
using OpenNest.Math;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.BestFit;
|
||||||
|
|
||||||
public class NfpSlideStrategyTests
|
public class NfpSlideStrategyTests
|
||||||
{
|
{
|
||||||
+1
-1
@@ -3,7 +3,7 @@ using System.Linq;
|
|||||||
using OpenNest.CNC;
|
using OpenNest.CNC;
|
||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.CutOffs;
|
||||||
|
|
||||||
public class CutOffGeometryTests
|
public class CutOffGeometryTests
|
||||||
{
|
{
|
||||||
+1
-1
@@ -2,7 +2,7 @@ using OpenNest.CNC;
|
|||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
using OpenNest.IO;
|
using OpenNest.IO;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.CutOffs;
|
||||||
|
|
||||||
public class CutOffSerializationTests
|
public class CutOffSerializationTests
|
||||||
{
|
{
|
||||||
@@ -2,7 +2,7 @@ using System.Linq;
|
|||||||
using OpenNest.CNC;
|
using OpenNest.CNC;
|
||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.CutOffs;
|
||||||
|
|
||||||
public class CutOffTests
|
public class CutOffTests
|
||||||
{
|
{
|
||||||
@@ -26,11 +26,11 @@ public class CutOffTests
|
|||||||
public void Plate_Utilization_ExcludesCutOffParts()
|
public void Plate_Utilization_ExcludesCutOffParts()
|
||||||
{
|
{
|
||||||
var pgm = new Program();
|
var pgm = new Program();
|
||||||
pgm.Codes.Add(new RapidMove(new Geometry.Vector(0, 0)));
|
pgm.Codes.Add(new RapidMove(new Vector(0, 0)));
|
||||||
pgm.Codes.Add(new LinearMove(new Geometry.Vector(10, 0)));
|
pgm.Codes.Add(new LinearMove(new Vector(10, 0)));
|
||||||
pgm.Codes.Add(new LinearMove(new Geometry.Vector(10, 10)));
|
pgm.Codes.Add(new LinearMove(new Vector(10, 10)));
|
||||||
pgm.Codes.Add(new LinearMove(new Geometry.Vector(0, 10)));
|
pgm.Codes.Add(new LinearMove(new Vector(0, 10)));
|
||||||
pgm.Codes.Add(new LinearMove(new Geometry.Vector(0, 0)));
|
pgm.Codes.Add(new LinearMove(new Vector(0, 0)));
|
||||||
var realDrawing = new Drawing("real", pgm);
|
var realDrawing = new Drawing("real", pgm);
|
||||||
var cutoffDrawing = new Drawing("cutoff", new Program()) { IsCutOff = true };
|
var cutoffDrawing = new Drawing("cutoff", new Program()) { IsCutOff = true };
|
||||||
|
|
||||||
@@ -47,11 +47,11 @@ public class CutOffTests
|
|||||||
public void Plate_HasOverlappingParts_SkipsCutOffParts()
|
public void Plate_HasOverlappingParts_SkipsCutOffParts()
|
||||||
{
|
{
|
||||||
var pgm = new Program();
|
var pgm = new Program();
|
||||||
pgm.Codes.Add(new RapidMove(new Geometry.Vector(0, 0)));
|
pgm.Codes.Add(new RapidMove(new Vector(0, 0)));
|
||||||
pgm.Codes.Add(new LinearMove(new Geometry.Vector(10, 0)));
|
pgm.Codes.Add(new LinearMove(new Vector(10, 0)));
|
||||||
pgm.Codes.Add(new LinearMove(new Geometry.Vector(10, 10)));
|
pgm.Codes.Add(new LinearMove(new Vector(10, 10)));
|
||||||
pgm.Codes.Add(new LinearMove(new Geometry.Vector(0, 10)));
|
pgm.Codes.Add(new LinearMove(new Vector(0, 10)));
|
||||||
pgm.Codes.Add(new LinearMove(new Geometry.Vector(0, 0)));
|
pgm.Codes.Add(new LinearMove(new Vector(0, 0)));
|
||||||
|
|
||||||
var realDrawing = new Drawing("real", pgm);
|
var realDrawing = new Drawing("real", pgm);
|
||||||
var cutoffDrawing = new Drawing("cutoff", pgm) { IsCutOff = true };
|
var cutoffDrawing = new Drawing("cutoff", pgm) { IsCutOff = true };
|
||||||
@@ -220,7 +220,7 @@ public class CutOffTests
|
|||||||
public void Plate_RegenerateCutOffs_MaterializesParts()
|
public void Plate_RegenerateCutOffs_MaterializesParts()
|
||||||
{
|
{
|
||||||
var plate = new Plate(100, 50);
|
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.CutOffs.Add(cutoff);
|
||||||
|
|
||||||
plate.RegenerateCutOffs(new CutOffSettings());
|
plate.RegenerateCutOffs(new CutOffSettings());
|
||||||
@@ -233,7 +233,7 @@ public class CutOffTests
|
|||||||
public void Plate_RegenerateCutOffs_ReplacesOldParts()
|
public void Plate_RegenerateCutOffs_ReplacesOldParts()
|
||||||
{
|
{
|
||||||
var plate = new Plate(100, 50);
|
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.CutOffs.Add(cutoff);
|
||||||
|
|
||||||
var settings = new CutOffSettings();
|
var settings = new CutOffSettings();
|
||||||
@@ -247,14 +247,14 @@ public class CutOffTests
|
|||||||
public void Plate_RegenerateCutOffs_DoesNotAffectRegularParts()
|
public void Plate_RegenerateCutOffs_DoesNotAffectRegularParts()
|
||||||
{
|
{
|
||||||
var pgm = new OpenNest.CNC.Program();
|
var pgm = new OpenNest.CNC.Program();
|
||||||
pgm.Codes.Add(new OpenNest.CNC.RapidMove(new Geometry.Vector(0, 0)));
|
pgm.Codes.Add(new OpenNest.CNC.RapidMove(new Vector(0, 0)));
|
||||||
pgm.Codes.Add(new OpenNest.CNC.LinearMove(new Geometry.Vector(5, 5)));
|
pgm.Codes.Add(new OpenNest.CNC.LinearMove(new Vector(5, 5)));
|
||||||
var drawing = new Drawing("real", pgm);
|
var drawing = new Drawing("real", pgm);
|
||||||
|
|
||||||
var plate = new Plate(100, 50);
|
var plate = new Plate(100, 50);
|
||||||
plate.Parts.Add(new Part(drawing));
|
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.CutOffs.Add(cutoff);
|
||||||
|
|
||||||
plate.RegenerateCutOffs(new CutOffSettings());
|
plate.RegenerateCutOffs(new CutOffSettings());
|
||||||
+1
-1
@@ -2,7 +2,7 @@ using OpenNest.CNC;
|
|||||||
using OpenNest.CNC.CuttingStrategy;
|
using OpenNest.CNC.CuttingStrategy;
|
||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.CuttingStrategy;
|
||||||
|
|
||||||
public class CuttingResultTests
|
public class CuttingResultTests
|
||||||
{
|
{
|
||||||
+1
-1
@@ -4,7 +4,7 @@ using OpenNest.Engine;
|
|||||||
using OpenNest.Engine.Sequencing;
|
using OpenNest.Engine.Sequencing;
|
||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.CuttingStrategy;
|
||||||
|
|
||||||
public class LeadInAssignerTests
|
public class LeadInAssignerTests
|
||||||
{
|
{
|
||||||
+1
-1
@@ -2,7 +2,7 @@ using OpenNest.CNC;
|
|||||||
using OpenNest.CNC.CuttingStrategy;
|
using OpenNest.CNC.CuttingStrategy;
|
||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.CuttingStrategy;
|
||||||
|
|
||||||
public class LeadInLayerTagTests
|
public class LeadInLayerTagTests
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
using OpenNest.CNC;
|
using OpenNest.CNC;
|
||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.CuttingStrategy;
|
||||||
|
|
||||||
public class MotionSuppressedTests
|
public class MotionSuppressedTests
|
||||||
{
|
{
|
||||||
+1
-1
@@ -2,7 +2,7 @@ using OpenNest.CNC;
|
|||||||
using OpenNest.CNC.CuttingStrategy;
|
using OpenNest.CNC.CuttingStrategy;
|
||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.CuttingStrategy;
|
||||||
|
|
||||||
public class PartLeadInTests
|
public class PartLeadInTests
|
||||||
{
|
{
|
||||||
@@ -3,7 +3,7 @@ using OpenNest.Geometry;
|
|||||||
using OpenNest.IO;
|
using OpenNest.IO;
|
||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Engine;
|
||||||
|
|
||||||
public class EngineOverlapTests
|
public class EngineOverlapTests
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Engine;
|
||||||
|
|
||||||
public class EngineRefactorSmokeTests
|
public class EngineRefactorSmokeTests
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Engine;
|
||||||
|
|
||||||
public class NestPhaseExtensionsTests
|
public class NestPhaseExtensionsTests
|
||||||
{
|
{
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Engine;
|
||||||
|
|
||||||
public class NestProgressTests
|
public class NestProgressTests
|
||||||
{
|
{
|
||||||
+1
-1
@@ -4,7 +4,7 @@ using OpenNest.Geometry;
|
|||||||
using OpenNest.Math;
|
using OpenNest.Math;
|
||||||
using OpenNest.Shapes;
|
using OpenNest.Shapes;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Engine;
|
||||||
|
|
||||||
public class PartClassifierTests
|
public class PartClassifierTests
|
||||||
{
|
{
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using OpenNest.CNC;
|
using OpenNest.CNC;
|
||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Engine;
|
||||||
|
|
||||||
public class PartFlagTests
|
public class PartFlagTests
|
||||||
{
|
{
|
||||||
+1
-1
@@ -3,7 +3,7 @@ using OpenNest.Engine;
|
|||||||
using OpenNest.Engine.RapidPlanning;
|
using OpenNest.Engine.RapidPlanning;
|
||||||
using OpenNest.Engine.Sequencing;
|
using OpenNest.Engine.Sequencing;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Engine;
|
||||||
|
|
||||||
public class PlateProcessorTests
|
public class PlateProcessorTests
|
||||||
{
|
{
|
||||||
@@ -2,7 +2,7 @@ using OpenNest.Engine;
|
|||||||
using OpenNest.Engine.Fill;
|
using OpenNest.Engine.Fill;
|
||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Engine;
|
||||||
|
|
||||||
public class RemnantEngineTests
|
public class RemnantEngineTests
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
using OpenNest.Engine.Fill;
|
using OpenNest.Engine.Fill;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Fill;
|
||||||
|
|
||||||
public class AccumulatingProgressTests
|
public class AccumulatingProgressTests
|
||||||
{
|
{
|
||||||
+1
-1
@@ -3,7 +3,7 @@ using OpenNest.Engine.Fill;
|
|||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
using OpenNest.Math;
|
using OpenNest.Math;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Fill;
|
||||||
|
|
||||||
public class AngleCandidateBuilderTests
|
public class AngleCandidateBuilderTests
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Fill;
|
||||||
|
|
||||||
public class BestCombinationTests
|
public class BestCombinationTests
|
||||||
{
|
{
|
||||||
@@ -4,7 +4,7 @@ using OpenNest.Geometry;
|
|||||||
using Xunit;
|
using Xunit;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace OpenNest.Tests
|
namespace OpenNest.Tests.Fill
|
||||||
{
|
{
|
||||||
public class CompactorTests
|
public class CompactorTests
|
||||||
{
|
{
|
||||||
@@ -2,7 +2,7 @@ using OpenNest.Engine;
|
|||||||
using OpenNest.Engine.Fill;
|
using OpenNest.Engine.Fill;
|
||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Fill;
|
||||||
|
|
||||||
public class DefaultFillComparerTests
|
public class DefaultFillComparerTests
|
||||||
{
|
{
|
||||||
@@ -2,7 +2,7 @@ using OpenNest.CNC;
|
|||||||
using OpenNest.Engine.Fill;
|
using OpenNest.Engine.Fill;
|
||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Fill;
|
||||||
|
|
||||||
public class FillExtentsTests
|
public class FillExtentsTests
|
||||||
{
|
{
|
||||||
@@ -3,7 +3,7 @@ using OpenNest.Engine.Fill;
|
|||||||
using OpenNest.Engine.Strategies;
|
using OpenNest.Engine.Strategies;
|
||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Fill;
|
||||||
|
|
||||||
public class FillWithDirectionPreferenceTests
|
public class FillWithDirectionPreferenceTests
|
||||||
{
|
{
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
|
using OpenNest.Geometry;
|
||||||
using OpenNest.Engine.Fill;
|
using OpenNest.Engine.Fill;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Fill;
|
||||||
|
|
||||||
public class FillScoreTests
|
public class FillScoreTests
|
||||||
{
|
{
|
||||||
@@ -48,7 +49,7 @@ public class FillScoreTests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void Compute_NullParts_ReturnsDefault()
|
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);
|
Assert.Equal(0, score.Count);
|
||||||
}
|
}
|
||||||
@@ -56,7 +57,7 @@ public class FillScoreTests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void Compute_EmptyParts_ReturnsDefault()
|
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);
|
Assert.Equal(0, score.Count);
|
||||||
}
|
}
|
||||||
@@ -70,7 +71,7 @@ public class FillScoreTests
|
|||||||
TestHelpers.MakePartAt(20, 0, 10),
|
TestHelpers.MakePartAt(20, 0, 10),
|
||||||
TestHelpers.MakePartAt(40, 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.Equal(3, score.Count);
|
||||||
Assert.True(score.Density > 0);
|
Assert.True(score.Density > 0);
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
using OpenNest.Engine.Fill;
|
using OpenNest.Engine.Fill;
|
||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Fill;
|
||||||
|
|
||||||
public class IterativeShrinkFillerTests
|
public class IterativeShrinkFillerTests
|
||||||
{
|
{
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using OpenNest.Engine.Fill;
|
using OpenNest.Engine.Fill;
|
||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Fill;
|
||||||
|
|
||||||
public class PairFillerTests
|
public class PairFillerTests
|
||||||
{
|
{
|
||||||
+1
-1
@@ -4,7 +4,7 @@ using OpenNest.Geometry;
|
|||||||
using OpenNest.Math;
|
using OpenNest.Math;
|
||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Fill;
|
||||||
|
|
||||||
public class PairOverlapDiagnosticTests
|
public class PairOverlapDiagnosticTests
|
||||||
{
|
{
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using OpenNest.Engine.Fill;
|
using OpenNest.Engine.Fill;
|
||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Fill;
|
||||||
|
|
||||||
public class PatternTilerTests
|
public class PatternTilerTests
|
||||||
{
|
{
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using OpenNest.Engine.Fill;
|
using OpenNest.Engine.Fill;
|
||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Fill;
|
||||||
|
|
||||||
public class RemnantFillerTests2
|
public class RemnantFillerTests2
|
||||||
{
|
{
|
||||||
@@ -2,7 +2,7 @@ using OpenNest.Engine.Fill;
|
|||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
using OpenNest.IO;
|
using OpenNest.IO;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Fill;
|
||||||
|
|
||||||
public class RemnantFinderTests
|
public class RemnantFinderTests
|
||||||
{
|
{
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using OpenNest.Engine.Fill;
|
using OpenNest.Engine.Fill;
|
||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Fill;
|
||||||
|
|
||||||
public class ShrinkFillerTests
|
public class ShrinkFillerTests
|
||||||
{
|
{
|
||||||
@@ -2,7 +2,7 @@ using OpenNest.Geometry;
|
|||||||
using OpenNest.Math;
|
using OpenNest.Math;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Geometry;
|
||||||
|
|
||||||
public class CollisionTests
|
public class CollisionTests
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
using OpenNest.Converters;
|
using OpenNest.Converters;
|
||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Geometry;
|
||||||
|
|
||||||
public class ContourClassificationTests
|
public class ContourClassificationTests
|
||||||
{
|
{
|
||||||
+1
-1
@@ -3,7 +3,7 @@ using OpenNest.Math;
|
|||||||
using Xunit;
|
using Xunit;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Geometry;
|
||||||
|
|
||||||
public class EllipseConverterTests
|
public class EllipseConverterTests
|
||||||
{
|
{
|
||||||
+1
-1
@@ -4,7 +4,7 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Geometry;
|
||||||
|
|
||||||
public class GeometrySimplifierTests
|
public class GeometrySimplifierTests
|
||||||
{
|
{
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Geometry;
|
||||||
|
|
||||||
public class PolyLabelTests
|
public class PolyLabelTests
|
||||||
{
|
{
|
||||||
+1
-1
@@ -3,7 +3,7 @@ using OpenNest.Engine.BestFit;
|
|||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
using OpenNest.Math;
|
using OpenNest.Math;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Geometry;
|
||||||
|
|
||||||
public class PolygonHelperTests
|
public class PolygonHelperTests
|
||||||
{
|
{
|
||||||
+1
-1
@@ -2,7 +2,7 @@ using OpenNest.Geometry;
|
|||||||
using OpenNest.Math;
|
using OpenNest.Math;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Geometry;
|
||||||
|
|
||||||
public class SplineConverterTests
|
public class SplineConverterTests
|
||||||
{
|
{
|
||||||
@@ -2,7 +2,7 @@ using OpenNest.Converters;
|
|||||||
using OpenNest.Geometry;
|
using OpenNest.Geometry;
|
||||||
using OpenNest.IO;
|
using OpenNest.IO;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.IO;
|
||||||
|
|
||||||
public class DxfRoundtripTests
|
public class DxfRoundtripTests
|
||||||
{
|
{
|
||||||
+1
-1
@@ -3,7 +3,7 @@ using OpenNest.Geometry;
|
|||||||
using OpenNest.IO;
|
using OpenNest.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.IO;
|
||||||
|
|
||||||
public class NestBendSerializationTests
|
public class NestBendSerializationTests
|
||||||
{
|
{
|
||||||
+1
-1
@@ -6,7 +6,7 @@ using OpenNest.Geometry;
|
|||||||
using OpenNest.IO;
|
using OpenNest.IO;
|
||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
|
|
||||||
namespace OpenNest.Tests;
|
namespace OpenNest.Tests.Strategies;
|
||||||
|
|
||||||
public class StrategyOverlapTests
|
public class StrategyOverlapTests
|
||||||
{
|
{
|
||||||
@@ -7,6 +7,7 @@ using System.Collections.Generic;
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace OpenNest.Actions
|
namespace OpenNest.Actions
|
||||||
@@ -341,8 +342,10 @@ namespace OpenNest.Actions
|
|||||||
cleanProgram = selectedPart.Program;
|
cleanProgram = selectedPart.Program;
|
||||||
}
|
}
|
||||||
|
|
||||||
var entities = ConvertProgram.ToGeometry(cleanProgram);
|
var entities = ConvertProgram.ToGeometry(cleanProgram)
|
||||||
entities.RemoveAll(e => e.Layer == SpecialLayers.Scribe);
|
.Where(e => e.Layer == SpecialLayers.Cut)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
profile = new ShapeProfile(entities);
|
profile = new ShapeProfile(entities);
|
||||||
|
|
||||||
contours = new List<ShapeInfo>();
|
contours = new List<ShapeInfo>();
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace OpenNest.Controls
|
|||||||
private readonly CollapsiblePanel bendLinesPanel;
|
private readonly CollapsiblePanel bendLinesPanel;
|
||||||
|
|
||||||
private readonly CheckedListBox layersList;
|
private readonly CheckedListBox layersList;
|
||||||
private readonly CheckedListBox colorsList;
|
private readonly ListBox colorsList;
|
||||||
private readonly CheckedListBox lineTypesList;
|
private readonly CheckedListBox lineTypesList;
|
||||||
private readonly ListBox bendLinesList;
|
private readonly ListBox bendLinesList;
|
||||||
private readonly LinkLabel bendAddLink;
|
private readonly LinkLabel bendAddLink;
|
||||||
@@ -91,7 +91,7 @@ namespace OpenNest.Controls
|
|||||||
HeaderText = "Line Types (0)",
|
HeaderText = "Line Types (0)",
|
||||||
Dock = DockStyle.Top,
|
Dock = DockStyle.Top,
|
||||||
ExpandedHeight = 100,
|
ExpandedHeight = 100,
|
||||||
IsExpanded = false
|
IsExpanded = true
|
||||||
};
|
};
|
||||||
lineTypesList = CreateCheckedList();
|
lineTypesList = CreateCheckedList();
|
||||||
lineTypesPanel.ContentPanel.Controls.Add(lineTypesList);
|
lineTypesPanel.ContentPanel.Controls.Add(lineTypesList);
|
||||||
@@ -102,12 +102,19 @@ namespace OpenNest.Controls
|
|||||||
HeaderText = "Colors (0)",
|
HeaderText = "Colors (0)",
|
||||||
Dock = DockStyle.Top,
|
Dock = DockStyle.Top,
|
||||||
ExpandedHeight = 100,
|
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.DrawItem += ColorsList_DrawItem;
|
||||||
|
colorsList.MouseClick += ColorsList_MouseClick;
|
||||||
colorsPanel.ContentPanel.Controls.Add(colorsList);
|
colorsPanel.ContentPanel.Controls.Add(colorsList);
|
||||||
|
|
||||||
// Layers (always expanded)
|
// Layers (always expanded)
|
||||||
@@ -174,7 +181,7 @@ namespace OpenNest.Controls
|
|||||||
.Distinct()
|
.Distinct()
|
||||||
.Select(argb => new ColorItem(Color.FromArgb(argb)));
|
.Select(argb => new ColorItem(Color.FromArgb(argb)));
|
||||||
foreach (var color in colors)
|
foreach (var color in colors)
|
||||||
colorsList.Items.Add(color, true); // checked = visible
|
colorsList.Items.Add(color);
|
||||||
|
|
||||||
colorsPanel.HeaderText = $"Colors ({colorsList.Items.Count})";
|
colorsPanel.HeaderText = $"Colors ({colorsList.Items.Count})";
|
||||||
|
|
||||||
@@ -213,8 +220,9 @@ namespace OpenNest.Controls
|
|||||||
var hiddenColors = new HashSet<int>();
|
var hiddenColors = new HashSet<int>();
|
||||||
for (var i = 0; i < colorsList.Items.Count; i++)
|
for (var i = 0; i < colorsList.Items.Count; i++)
|
||||||
{
|
{
|
||||||
if (!colorsList.GetItemChecked(i))
|
var item = (ColorItem)colorsList.Items[i];
|
||||||
hiddenColors.Add(((ColorItem)colorsList.Items[i]).Argb);
|
if (!item.IsChecked)
|
||||||
|
hiddenColors.Add(item.Argb);
|
||||||
}
|
}
|
||||||
|
|
||||||
var hiddenLineTypes = new HashSet<string>();
|
var hiddenLineTypes = new HashSet<string>();
|
||||||
@@ -242,20 +250,39 @@ namespace OpenNest.Controls
|
|||||||
list.SetItemChecked(i, isChecked);
|
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)
|
private void ColorsList_DrawItem(object sender, DrawItemEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Index < 0) return;
|
if (e.Index < 0) return;
|
||||||
|
|
||||||
e.DrawBackground();
|
e.Graphics.FillRectangle(Brushes.White, e.Bounds);
|
||||||
|
|
||||||
var colorItem = (ColorItem)colorsList.Items[e.Index];
|
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))
|
using (var brush = new SolidBrush(colorItem.Color))
|
||||||
e.Graphics.FillRectangle(brush, swatchRect);
|
e.Graphics.FillRectangle(brush, swatchRect);
|
||||||
e.Graphics.DrawRectangle(Pens.Gray, 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)
|
public void SetPickMode(bool active)
|
||||||
@@ -269,6 +296,7 @@ namespace OpenNest.Controls
|
|||||||
{
|
{
|
||||||
public int Argb { get; }
|
public int Argb { get; }
|
||||||
public Color Color { get; }
|
public Color Color { get; }
|
||||||
|
public bool IsChecked { get; set; } = true;
|
||||||
|
|
||||||
public ColorItem(Color color)
|
public ColorItem(Color color)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -50,14 +50,6 @@ namespace OpenNest.Controls
|
|||||||
|
|
||||||
contours = ContourInfo.Classify(shapes);
|
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);
|
Program = BuildProgram(contours);
|
||||||
isDirty = false;
|
isDirty = false;
|
||||||
isLoaded = true;
|
isLoaded = true;
|
||||||
@@ -144,33 +136,38 @@ namespace OpenNest.Controls
|
|||||||
preview.ClearPenCache();
|
preview.ClearPenCache();
|
||||||
preview.Entities.Clear();
|
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++)
|
for (var i = 0; i < contours.Count; i++)
|
||||||
{
|
{
|
||||||
var contour = contours[i];
|
var contour = contours[i];
|
||||||
var selected = contourList.SelectedIndices.Contains(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)
|
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.ZoomToFit();
|
||||||
preview.Invalidate();
|
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)
|
private static Color GetContourColor(ContourClassification type, bool selected)
|
||||||
{
|
{
|
||||||
if (selected)
|
if (selected)
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
+53
-53
@@ -17,14 +17,12 @@ namespace OpenNest.Forms
|
|||||||
{
|
{
|
||||||
mainSplit = new System.Windows.Forms.SplitContainer();
|
mainSplit = new System.Windows.Forms.SplitContainer();
|
||||||
fileList = new OpenNest.Controls.FileListControl();
|
fileList = new OpenNest.Controls.FileListControl();
|
||||||
|
viewTabs = new System.Windows.Forms.TabControl();
|
||||||
|
tabCadView = new System.Windows.Forms.TabPage();
|
||||||
cadViewSplit = new System.Windows.Forms.SplitContainer();
|
cadViewSplit = new System.Windows.Forms.SplitContainer();
|
||||||
filterPanel = new OpenNest.Controls.FilterPanel();
|
filterPanel = new OpenNest.Controls.FilterPanel();
|
||||||
entityView1 = new OpenNest.Controls.EntityView();
|
entityView1 = new OpenNest.Controls.EntityView();
|
||||||
detailBar = new System.Windows.Forms.FlowLayoutPanel();
|
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();
|
lblQty = new System.Windows.Forms.Label();
|
||||||
numQuantity = new System.Windows.Forms.NumericUpDown();
|
numQuantity = new System.Windows.Forms.NumericUpDown();
|
||||||
lblCust = new System.Windows.Forms.Label();
|
lblCust = new System.Windows.Forms.Label();
|
||||||
@@ -38,6 +36,8 @@ namespace OpenNest.Forms
|
|||||||
chkLabels = new System.Windows.Forms.CheckBox();
|
chkLabels = new System.Windows.Forms.CheckBox();
|
||||||
lblDetect = new System.Windows.Forms.Label();
|
lblDetect = new System.Windows.Forms.Label();
|
||||||
cboBendDetector = new System.Windows.Forms.ComboBox();
|
cboBendDetector = new System.Windows.Forms.ComboBox();
|
||||||
|
tabProgram = new System.Windows.Forms.TabPage();
|
||||||
|
programEditor = new OpenNest.Controls.ProgramEditorControl();
|
||||||
bottomPanel1 = new OpenNest.Controls.BottomPanel();
|
bottomPanel1 = new OpenNest.Controls.BottomPanel();
|
||||||
cancelButton = new System.Windows.Forms.Button();
|
cancelButton = new System.Windows.Forms.Button();
|
||||||
acceptButton = new System.Windows.Forms.Button();
|
acceptButton = new System.Windows.Forms.Button();
|
||||||
@@ -45,15 +45,15 @@ namespace OpenNest.Forms
|
|||||||
mainSplit.Panel1.SuspendLayout();
|
mainSplit.Panel1.SuspendLayout();
|
||||||
mainSplit.Panel2.SuspendLayout();
|
mainSplit.Panel2.SuspendLayout();
|
||||||
mainSplit.SuspendLayout();
|
mainSplit.SuspendLayout();
|
||||||
|
viewTabs.SuspendLayout();
|
||||||
|
tabCadView.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)cadViewSplit).BeginInit();
|
((System.ComponentModel.ISupportInitialize)cadViewSplit).BeginInit();
|
||||||
cadViewSplit.Panel1.SuspendLayout();
|
cadViewSplit.Panel1.SuspendLayout();
|
||||||
cadViewSplit.Panel2.SuspendLayout();
|
cadViewSplit.Panel2.SuspendLayout();
|
||||||
cadViewSplit.SuspendLayout();
|
cadViewSplit.SuspendLayout();
|
||||||
detailBar.SuspendLayout();
|
detailBar.SuspendLayout();
|
||||||
viewTabs.SuspendLayout();
|
|
||||||
tabCadView.SuspendLayout();
|
|
||||||
tabProgram.SuspendLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)numQuantity).BeginInit();
|
((System.ComponentModel.ISupportInitialize)numQuantity).BeginInit();
|
||||||
|
tabProgram.SuspendLayout();
|
||||||
bottomPanel1.SuspendLayout();
|
bottomPanel1.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
@@ -88,6 +88,27 @@ namespace OpenNest.Forms
|
|||||||
fileList.Size = new System.Drawing.Size(260, 670);
|
fileList.Size = new System.Drawing.Size(260, 670);
|
||||||
fileList.TabIndex = 0;
|
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
|
||||||
//
|
//
|
||||||
cadViewSplit.Dock = System.Windows.Forms.DockStyle.Fill;
|
cadViewSplit.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
@@ -95,12 +116,12 @@ namespace OpenNest.Forms
|
|||||||
cadViewSplit.Location = new System.Drawing.Point(0, 0);
|
cadViewSplit.Location = new System.Drawing.Point(0, 0);
|
||||||
cadViewSplit.Name = "cadViewSplit";
|
cadViewSplit.Name = "cadViewSplit";
|
||||||
//
|
//
|
||||||
// cadViewSplit.Panel1 — filter panel
|
// cadViewSplit.Panel1
|
||||||
//
|
//
|
||||||
cadViewSplit.Panel1.Controls.Add(filterPanel);
|
cadViewSplit.Panel1.Controls.Add(filterPanel);
|
||||||
cadViewSplit.Panel1MinSize = 150;
|
cadViewSplit.Panel1MinSize = 150;
|
||||||
//
|
//
|
||||||
// cadViewSplit.Panel2 — entity view + detail bar
|
// cadViewSplit.Panel2
|
||||||
//
|
//
|
||||||
cadViewSplit.Panel2.Controls.Add(entityView1);
|
cadViewSplit.Panel2.Controls.Add(entityView1);
|
||||||
cadViewSplit.Panel2.Controls.Add(detailBar);
|
cadViewSplit.Panel2.Controls.Add(detailBar);
|
||||||
@@ -118,6 +139,7 @@ namespace OpenNest.Forms
|
|||||||
filterPanel.Name = "filterPanel";
|
filterPanel.Name = "filterPanel";
|
||||||
filterPanel.Size = new System.Drawing.Size(200, 642);
|
filterPanel.Size = new System.Drawing.Size(200, 642);
|
||||||
filterPanel.TabIndex = 0;
|
filterPanel.TabIndex = 0;
|
||||||
|
filterPanel.Paint += filterPanel_Paint;
|
||||||
//
|
//
|
||||||
// entityView1
|
// entityView1
|
||||||
//
|
//
|
||||||
@@ -128,6 +150,7 @@ namespace OpenNest.Forms
|
|||||||
entityView1.Location = new System.Drawing.Point(0, 0);
|
entityView1.Location = new System.Drawing.Point(0, 0);
|
||||||
entityView1.Name = "entityView1";
|
entityView1.Name = "entityView1";
|
||||||
entityView1.OriginalEntities = null;
|
entityView1.OriginalEntities = null;
|
||||||
|
entityView1.PaintOverlay = null;
|
||||||
entityView1.ShowEntityLabels = false;
|
entityView1.ShowEntityLabels = false;
|
||||||
entityView1.SimplifierHighlight = null;
|
entityView1.SimplifierHighlight = null;
|
||||||
entityView1.SimplifierPreview = null;
|
entityView1.SimplifierPreview = null;
|
||||||
@@ -153,7 +176,7 @@ namespace OpenNest.Forms
|
|||||||
detailBar.Controls.Add(lblDetect);
|
detailBar.Controls.Add(lblDetect);
|
||||||
detailBar.Controls.Add(cboBendDetector);
|
detailBar.Controls.Add(cboBendDetector);
|
||||||
detailBar.Dock = System.Windows.Forms.DockStyle.Bottom;
|
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.Name = "detailBar";
|
||||||
detailBar.Padding = new System.Windows.Forms.Padding(4, 6, 4, 4);
|
detailBar.Padding = new System.Windows.Forms.Padding(4, 6, 4, 4);
|
||||||
detailBar.Size = new System.Drawing.Size(546, 36);
|
detailBar.Size = new System.Drawing.Size(546, 36);
|
||||||
@@ -308,6 +331,24 @@ namespace OpenNest.Forms
|
|||||||
cboBendDetector.Size = new System.Drawing.Size(90, 23);
|
cboBendDetector.Size = new System.Drawing.Size(90, 23);
|
||||||
cboBendDetector.TabIndex = 8;
|
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
|
||||||
//
|
//
|
||||||
bottomPanel1.Controls.Add(cancelButton);
|
bottomPanel1.Controls.Add(cancelButton);
|
||||||
@@ -342,47 +383,6 @@ namespace OpenNest.Forms
|
|||||||
acceptButton.TabIndex = 1;
|
acceptButton.TabIndex = 1;
|
||||||
acceptButton.Text = "Accept";
|
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
|
// CadConverterForm
|
||||||
//
|
//
|
||||||
AllowDrop = true;
|
AllowDrop = true;
|
||||||
@@ -402,6 +402,8 @@ namespace OpenNest.Forms
|
|||||||
mainSplit.Panel2.ResumeLayout(false);
|
mainSplit.Panel2.ResumeLayout(false);
|
||||||
((System.ComponentModel.ISupportInitialize)mainSplit).EndInit();
|
((System.ComponentModel.ISupportInitialize)mainSplit).EndInit();
|
||||||
mainSplit.ResumeLayout(false);
|
mainSplit.ResumeLayout(false);
|
||||||
|
viewTabs.ResumeLayout(false);
|
||||||
|
tabCadView.ResumeLayout(false);
|
||||||
cadViewSplit.Panel1.ResumeLayout(false);
|
cadViewSplit.Panel1.ResumeLayout(false);
|
||||||
cadViewSplit.Panel2.ResumeLayout(false);
|
cadViewSplit.Panel2.ResumeLayout(false);
|
||||||
((System.ComponentModel.ISupportInitialize)cadViewSplit).EndInit();
|
((System.ComponentModel.ISupportInitialize)cadViewSplit).EndInit();
|
||||||
@@ -409,8 +411,6 @@ namespace OpenNest.Forms
|
|||||||
detailBar.ResumeLayout(false);
|
detailBar.ResumeLayout(false);
|
||||||
detailBar.PerformLayout();
|
detailBar.PerformLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)numQuantity).EndInit();
|
((System.ComponentModel.ISupportInitialize)numQuantity).EndInit();
|
||||||
viewTabs.ResumeLayout(false);
|
|
||||||
tabCadView.ResumeLayout(false);
|
|
||||||
tabProgram.ResumeLayout(false);
|
tabProgram.ResumeLayout(false);
|
||||||
bottomPanel1.ResumeLayout(false);
|
bottomPanel1.ResumeLayout(false);
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
|
|||||||
@@ -161,8 +161,6 @@ namespace OpenNest.Forms
|
|||||||
item.Entities.ForEach(e => e.Layer.IsVisible = true);
|
item.Entities.ForEach(e => e.Layer.IsVisible = true);
|
||||||
ReHidePromotedEntities(item.Bends);
|
ReHidePromotedEntities(item.Bends);
|
||||||
|
|
||||||
ApplyContourColors(item.Entities);
|
|
||||||
|
|
||||||
filterPanel.LoadItem(item.Entities, item.Bends);
|
filterPanel.LoadItem(item.Entities, item.Bends);
|
||||||
|
|
||||||
numQuantity.Value = item.Quantity;
|
numQuantity.Value = item.Quantity;
|
||||||
@@ -178,30 +176,6 @@ namespace OpenNest.Forms
|
|||||||
CheckSimplifiable(item);
|
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)
|
private void CheckSimplifiable(FileListItem item)
|
||||||
{
|
{
|
||||||
ResetSimplifyButton();
|
ResetSimplifyButton();
|
||||||
@@ -293,10 +267,6 @@ namespace OpenNest.Forms
|
|||||||
var normalized = ShapeProfile.NormalizeEntities(entities);
|
var normalized = ShapeProfile.NormalizeEntities(entities);
|
||||||
programEditor.LoadEntities(normalized);
|
programEditor.LoadEntities(normalized);
|
||||||
staleProgram = false;
|
staleProgram = false;
|
||||||
|
|
||||||
// Refresh CAD view to show contour-type colors
|
|
||||||
entityView1.ClearPenCache();
|
|
||||||
entityView1.Invalidate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnBendLineSelected(object sender, int index)
|
private void OnBendLineSelected(object sender, int index)
|
||||||
@@ -728,5 +698,10 @@ namespace OpenNest.Forms
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private void filterPanel_Paint(object sender, PaintEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+37
-12
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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);
|
||||||
|
|||||||
Generated
+7
-42
@@ -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;
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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
@@ -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);
|
||||||
|
|||||||
@@ -474,7 +474,7 @@ public partial class SplitDrawingForm : Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Placement preview line
|
// Placement preview line
|
||||||
if (_placingLine && _placingCursor != null)
|
if (_placingLine)
|
||||||
{
|
{
|
||||||
var isVert = _currentAxis == CutOffAxis.Vertical;
|
var isVert = _currentAxis == CutOffAxis.Vertical;
|
||||||
var snapped = _placingCursor;
|
var snapped = _placingCursor;
|
||||||
|
|||||||
Reference in New Issue
Block a user