mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-20 06:37:40 -05:00
Bands were always the full work-area height and placed flush to the bottom or top edge. On N26-2HH (20 + 20 formed legs, 60 x 120, bottom clamp rail) the larger leg's full-height band had less slack than the rail's depth, so three copies dropped to the gap fill and Auto Nest ended at 104.71 against a hand layout at 104.0. Each type now also offers up to three lower bands, each asked for just short of the last band's height and searched over three lengths, which leave a strip along the sheet for the remaining parts. A band that would lose members to clamps also tries the top edge and just past the clamps lining either edge (ClampObstacles.ClearOfEdges, moved out of EdgeFirstFill). N26-2HH now ends at 103.87; the README sample, help tutorial and N26-2GT layouts are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
40 lines
1.7 KiB
C#
40 lines
1.7 KiB
C#
using OpenNest.Clamps;
|
|
using OpenNest.Engine.Jobs;
|
|
using OpenNest.Engine.Jobs.Adapters;
|
|
using OpenNest.Engine.NestingEngines.Irregular;
|
|
using OpenNest.Geometry;
|
|
using static OpenNest.Engine.Tests.NestingEngines.JobBuilder;
|
|
|
|
namespace OpenNest.Engine.Tests.NestingEngines;
|
|
|
|
/// <summary>
|
|
/// Banded fill on a sheet with a clamp rail along its bottom edge. The larger part's full-height
|
|
/// band fills the work area to within less than the rail's depth, so it cannot clear the clamps
|
|
/// and the copies on them went to the gap fill, ending the layout at 104.36. A band a row lower
|
|
/// seats whole clear of the rail and leaves a strip for the last copies; the layout ends at 103.95.
|
|
/// </summary>
|
|
public class IrregularBandedClampTests
|
|
{
|
|
private static ClampZone[] Rail() => Enumerable.Range(0, 6)
|
|
.Select(i => new ClampZone($"clamp-{i + 1}", new Box(19.25 + 20 * i, 0, 1.5, 0.625))).ToArray();
|
|
|
|
[Fact]
|
|
public void LowerBandClearsABottomClampRail()
|
|
{
|
|
var stock = Stock("sheet", 60, 120, spacing: 0.25, edge: new Spacing(0.25, 0.25, 0.25, 0.25),
|
|
clampZones: Rail());
|
|
var job = Job([
|
|
Part("large", Shapes.Rectangle(22.5, 7.2), 20, RotationPolicy.Automatic),
|
|
Part("small", Shapes.Rectangle(18, 6), 20, RotationPolicy.Automatic),
|
|
], [stock]);
|
|
|
|
var result = new IrregularNestingEngine().Solve(job);
|
|
|
|
LayoutAssert.Valid(job, result);
|
|
var plate = Assert.Single(NestResultMaterializer.Materialize(job, result).Nest.Plates);
|
|
Assert.Equal(40, plate.Parts.Count);
|
|
var right = plate.Parts.Max(p => p.BoundingBox.Right);
|
|
Assert.True(right < 104.2, $"Layout ends at {right:F3}");
|
|
}
|
|
}
|