fix(engine): compute unused area from actual part areas
Calculate unused plate area by subtracting total part area from the work area instead of relying on FillScore.UsableRemnantArea, which could over-report available space. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -723,9 +723,13 @@ namespace OpenNest
|
|||||||
|
|
||||||
var score = FillScore.Compute(best, workArea);
|
var score = FillScore.Compute(best, workArea);
|
||||||
var clonedParts = new List<Part>(best.Count);
|
var clonedParts = new List<Part>(best.Count);
|
||||||
|
var totalPartArea = 0.0;
|
||||||
|
|
||||||
foreach (var part in best)
|
foreach (var part in best)
|
||||||
|
{
|
||||||
clonedParts.Add((Part)part.Clone());
|
clonedParts.Add((Part)part.Clone());
|
||||||
|
totalPartArea += part.BaseDrawing.Area;
|
||||||
|
}
|
||||||
|
|
||||||
progress.Report(new NestProgress
|
progress.Report(new NestProgress
|
||||||
{
|
{
|
||||||
@@ -733,7 +737,7 @@ namespace OpenNest
|
|||||||
PlateNumber = plateNumber,
|
PlateNumber = plateNumber,
|
||||||
BestPartCount = score.Count,
|
BestPartCount = score.Count,
|
||||||
BestDensity = score.Density,
|
BestDensity = score.Density,
|
||||||
UsableRemnantArea = score.UsableRemnantArea,
|
UsableRemnantArea = workArea.Area() - totalPartArea,
|
||||||
BestParts = clonedParts
|
BestParts = clonedParts
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user