Files
OpenNest/OpenNest.Core/TabbedCutouts/TabbedCutout.cs
T
ajandClaude Opus 5.5 ba39c3dc55 feat(cad): add tabbed cutouts with draggable tabs
A hole can now be declared a tabbed cutout in the CAD Converter: pick a
circle or any edge of a closed hole, set the tab count and width, and drag
the tabs around the hole. The definition persists on the drawing and in the
nest file, and stays editable from the source entities.

The builder replaces the hole with open cut pieces and uncut spans on a new
Tab layer. Tabs are material, so area, nesting and overlap checks still see
a closed hole, but they are never cut. Plan Cutting and Assign Lead-ins cut
each piece from the slug with the internal lead-in and no lead-out. A lead
that would reach back over a tab is mirrored, and an arc lead onto an arc
pierces straight in. Planning accounts for each span between tabs and runs
the open-cut proof, so its own tabbed cutouts certify; tabs followed by a
lead-out are still refused. Pre-post review flags programs that still
contain tab motions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 00:50:11 -04:00

41 lines
1.5 KiB
C#

using System;
using System.Collections.Generic;
namespace OpenNest.TabbedCutouts
{
/// <summary>
/// A cutout (a closed hole in a part) whose slug stays attached by uncut tabs. It is identified
/// by the source entities of the hole's contour. Building the drawing cuts the contour as open
/// pieces between the tabs, each entered from the slug with no lead-out, and keeps the tabs on
/// the <see cref="SpecialLayers.Tab"/> layer so the hole still bounds material. All values are
/// in the source frame.
/// </summary>
public sealed class TabbedCutout
{
public const double DefaultTabWidth = 0.0625;
public const int DefaultTabCount = 2;
public const int MinTabCount = 1;
/// <summary>Source entity IDs of the hole's closed contour.</summary>
public List<Guid> EdgeIds { get; set; } = new();
/// <summary>Uncut length of each tab along the contour.</summary>
public double TabWidth { get; set; } = DefaultTabWidth;
/// <summary>
/// Tab centers as distances along the contour, counterclockwise from its lowest-left
/// vertex (the smallest X, then Y), ascending. Empty means <see cref="DefaultTabCount"/>
/// evenly spaced.
/// </summary>
public List<double> TabCenters { get; set; } = new();
public TabbedCutout Clone() =>
new()
{
EdgeIds = new List<Guid>(EdgeIds),
TabWidth = TabWidth,
TabCenters = new List<double>(TabCenters),
};
}
}