mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-10-27 13:51:06 -04:00
A tabbed cutout's slug stays attached while the sheet is cut, but nesting saw a closed hole and could place parts inside it. Nesting and layout paths now read material through NestingMaterial.ForNesting, which drops closed contours with tab spans so the slug counts as part. That covers part outlines and collision lines, the cutout router, fill expansion, best-fit, NestLayoutCheck and the GPU bitmaps. Area, overlap diagnostics and cutting keep the hole, and programs without tabs read exactly as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
30 lines
1.2 KiB
C#
30 lines
1.2 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using OpenNest.Geometry;
|
|
|
|
namespace OpenNest
|
|
{
|
|
public static class NestingMaterial
|
|
{
|
|
/// <summary>
|
|
/// The material entities nesting and layout validation place parts against: those
|
|
/// <see cref="SpecialLayers.IsMaterial"/> keeps, except that a tabbed cutout's slug stays
|
|
/// attached while the sheet is cut, so a closed hole with <see cref="SpecialLayers.Tab"/>
|
|
/// spans is dropped and its slug counts as part. Area, overlap diagnostics and cutting
|
|
/// keep the hole. Entities without tab spans pass through unchanged.
|
|
/// </summary>
|
|
public static List<Entity> ForNesting(this IEnumerable<Entity> entities)
|
|
{
|
|
var material = entities.Where(e => SpecialLayers.IsMaterial(e.Layer)).ToList();
|
|
if (!material.Exists(e => e.Layer == SpecialLayers.Tab))
|
|
return material;
|
|
|
|
var kept = new List<Entity>();
|
|
foreach (var shape in ShapeBuilder.GetShapes(material))
|
|
if (!shape.Entities.Exists(e => e.Layer == SpecialLayers.Tab))
|
|
kept.AddRange(shape.Entities);
|
|
return kept;
|
|
}
|
|
}
|
|
}
|