mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-10-27 15:01:07 -04:00
fix(console): give the DXF-only plate a quantity of 1
LoadOrCreateNest built the DXF-only plate with `new Plate`, leaving Quantity at 0, so results reported "Parts placed: 0" and 0% weighted utilization, and drawings' nested quantities stayed at zero. Build it through Nest.CreatePlate as the desktop does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
61ad85768d
commit
13d75854c3
2 files changed
+18
-2
No files matched your search
@@ -372,9 +372,11 @@ static class NestConsole
|
||||
return null;
|
||||
}
|
||||
|
||||
// Build the plate as the desktop does: Quantity = 1 so part counts and the
|
||||
// drawings' nested quantities include it.
|
||||
var newNest = new Nest { Name = "DXF Import" };
|
||||
var plate = new Plate { Size = options.PlateSize.Value };
|
||||
newNest.Plates.Add(plate);
|
||||
newNest.PlateDefaults.Size = options.PlateSize.Value;
|
||||
newNest.CreatePlate();
|
||||
|
||||
foreach (var dxf in dxfFiles)
|
||||
{
|
||||
|
||||
@@ -326,6 +326,20 @@ public class NestingPipelineTests : IDisposable
|
||||
Assert.False(File.Exists(output));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Console_DxfOnlyFillCountsPlacedPartsOnASingleSheet()
|
||||
{
|
||||
var input = Path.Combine(directory, "square.dxf");
|
||||
var output = Path.Combine(directory, "output.nest");
|
||||
Dxf.ExportProgram(Square().Program, input);
|
||||
Assert.Equal(0, RunConsole(input, "--size", "20x30", "--quantity", "6", "--output", output));
|
||||
var nest = new NestReader(output).Read();
|
||||
var plate = nest.Plates.Single();
|
||||
Assert.Equal(1, plate.Quantity);
|
||||
Assert.Equal(6, plate.Parts.Count);
|
||||
Assert.Equal(plate.Parts.Count, nest.Drawings.Single().Quantity.Nested);
|
||||
}
|
||||
|
||||
private NestRequest Request(string engine)
|
||||
{
|
||||
var path = Path.Combine(directory, "square.dxf");
|
||||
|
||||
Reference in new issue
Block a user