mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-27 22:01:35 -05:00
feat(desktop): show Auto Nest as a sheet strip with a Keep/Discard review
Auto Nest no longer draws parts on the plate view before they are kept: its result is a set of sheets, possibly of several sizes, not parts on the current plate. Ghost parts stay with interactive Fill and remnant tools. - NestJobStage.PlanImproved carries an engine's best whole-job plan so far; Irregular reports one whenever a variant or the tail re-plan beats it. - NestPipeline adds PlanSheets: the plan on detached drawings built from the job geometry (with the caller's names and colors), so previews never touch caller drawings or quantities. - SheetStripControl draws every sheet side by side at one scale, repeats once with their count, captioned with size, parts and utilization. - The progress window shows "Best plan so far"; a review window shows the final sheets, totals, cost summary and unplaced parts before commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a2fb945669
commit
cd2bea054b
13 files changed
+692
-47
No files matched your search
@@ -1,13 +1,13 @@
|
||||
using OpenNest.Engine.NestingEngines.Irregular;
|
||||
using static OpenNest.Engine.Tests.NestingEngines.JobBuilder;
|
||||
using static OpenNest.Engine.Tests.NestingEngines.Shapes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenNest.CNC;
|
||||
using OpenNest.Engine.Jobs;
|
||||
using OpenNest.Engine.Jobs.Adapters;
|
||||
using OpenNest.Engine.NestingEngines.Irregular;
|
||||
using OpenNest.Geometry;
|
||||
using static OpenNest.Engine.Tests.NestingEngines.JobBuilder;
|
||||
using static OpenNest.Engine.Tests.NestingEngines.Shapes;
|
||||
|
||||
namespace OpenNest.Engine.Tests.NestingEngines;
|
||||
|
||||
@@ -211,6 +211,32 @@ public class IrregularNestingEngineTests
|
||||
Assert.Equal(2, Assert.Single(result.Plates).Placements.Count);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReportsEachBetterPlanEndingWithTheReturnedLayout()
|
||||
{
|
||||
var job = Job(new[] { Part("disc", Disc(3), 10), Part("ell", LShape(12, 8, 4), 10) },
|
||||
new[] { Stock("sheet", 40, 60, spacing: 0.5) });
|
||||
var reports = new List<NestJobProgress>();
|
||||
|
||||
var result = new IrregularNestingEngine().Solve(job, new SyncProgress(reports.Add));
|
||||
var without = new IrregularNestingEngine().Solve(job);
|
||||
|
||||
var plans = reports.Where(r => r.Stage == NestJobStage.PlanImproved).ToList();
|
||||
Assert.NotEmpty(plans);
|
||||
// Plans are proposals, never commits: they carry no committed counts.
|
||||
Assert.All(plans, p => Assert.Equal((0, 0), (p.CommittedPlates, p.CommittedParts)));
|
||||
Assert.Equal(result.Plates.SelectMany(p => p.Placements), plans[^1].Plan.Plates.SelectMany(p => p.Placements));
|
||||
Assert.True(reports.FindLastIndex(r => r.Stage == NestJobStage.PlanImproved)
|
||||
< reports.FindIndex(r => r.Stage == NestJobStage.PlateCommitted));
|
||||
// Reporting never steers the search.
|
||||
Assert.Equal(without.Plates.SelectMany(p => p.Placements), result.Plates.SelectMany(p => p.Placements));
|
||||
}
|
||||
|
||||
private sealed class SyncProgress(Action<NestJobProgress> report) : IProgress<NestJobProgress>
|
||||
{
|
||||
public void Report(NestJobProgress value) => report(value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void HasPublicParameterlessConstructorForPluginDiscovery()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user