feat: add part classification (large/medium/small) to MultiPlateNester
Introduces PartClass enum and Classify() static method that categorizes parts as Large (exceeds half work area in either dimension), Medium (area > 1/9 work area), or Small. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,8 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenNest.Geometry;
|
||||
|
||||
namespace OpenNest
|
||||
{
|
||||
public enum PartClass
|
||||
{
|
||||
Large,
|
||||
Medium,
|
||||
Small,
|
||||
}
|
||||
|
||||
public static class MultiPlateNester
|
||||
{
|
||||
public static List<NestItem> SortItems(List<NestItem> items, PartSortOrder sortOrder)
|
||||
@@ -31,5 +39,22 @@ namespace OpenNest
|
||||
return items.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public static PartClass Classify(Box partBounds, Box workArea)
|
||||
{
|
||||
var halfWidth = workArea.Width / 2.0;
|
||||
var halfLength = workArea.Length / 2.0;
|
||||
|
||||
if (partBounds.Width > halfWidth || partBounds.Length > halfLength)
|
||||
return PartClass.Large;
|
||||
|
||||
var workAreaArea = workArea.Width * workArea.Length;
|
||||
var partArea = partBounds.Width * partBounds.Length;
|
||||
|
||||
if (partArea > workAreaArea / 9.0)
|
||||
return PartClass.Medium;
|
||||
|
||||
return PartClass.Small;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user