mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-26 18:27:39 -05:00
The best tab point used to land in inside corners: equally good points run along a straight edge, vertices were tried first and the first tie won. Operators cannot grind a nub flush there. - SupportAnalyzer finds inside corners (inward-turning vertex runs of at least 30 degrees, so chorded fillets count) and keeps tab points a clearance from them; of equally good points it picks the one farthest from an inside corner. Plan Cutting and the overlay use twice the tab size; AcceptsTabAt rejects closer points - When no steadying entry has a lead-in that fits, the search falls back to entries clear of inside corners, then to every entry, each ordered by how well the tab steadies the part, keeping only the steadiest that fit - Replay notes parts whose planned tab cannot hold them level or sits in an inside corner; the notes are advisory and leave a Ready plan Ready - Console/MCP plate summaries print a ready plan's notes - docs/support-tabs.md and cutting-planner notes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
79 lines
3.0 KiB
C#
79 lines
3.0 KiB
C#
using System;
|
|
using OpenNest.Diagnostics;
|
|
using OpenNest.Geometry;
|
|
|
|
namespace OpenNest.CNC.CuttingPlanning;
|
|
|
|
/// <summary>Automatic start preference, ordered: a lower value is more preferred.</summary>
|
|
internal enum AutomaticEntryKind
|
|
{
|
|
/// <summary>A convex turn of the contour's own travel, classified exactly as emission classifies it.</summary>
|
|
ConvexCorner = 0,
|
|
|
|
/// <summary>The midpoint of a straight edge.</summary>
|
|
StraightMidpoint = 1,
|
|
|
|
/// <summary>A tangent line/arc joint. A collinear line/line split is not a joint and never appears.</summary>
|
|
TangentJoint = 2,
|
|
|
|
/// <summary>
|
|
/// Tier 3 (fallback): a point on a straight edge meeting a convex corner, back from the
|
|
/// corner by about twice the applicable lead-in length, strictly inside the edge.
|
|
/// </summary>
|
|
NearCorner = 3,
|
|
|
|
/// <summary>
|
|
/// Tier 3 (fallback): the exact native closest point facing the caller's look-ahead
|
|
/// position (pass the arrival there when there is no next cut). Never a reflex/cusp vertex.
|
|
/// </summary>
|
|
TargetFacing = 4,
|
|
|
|
/// <summary>Tier 3 (fallback): the native midpoint of an arc entity.</summary>
|
|
ArcMidpoint = 5,
|
|
|
|
/// <summary>Tier 3 (fallback): one of the eight compass points of a whole circle.</summary>
|
|
CircleCompass = 6,
|
|
|
|
/// <summary>A drawing pin's own entry: the one and only candidate of a pinned contour.</summary>
|
|
Pinned = 7,
|
|
|
|
/// <summary>
|
|
/// The perimeter point where a tab best keeps the part level on its support bed; only a
|
|
/// perimeter tabbed for support has it (see <see cref="PreparedContours.WithSupportTab"/>).
|
|
/// </summary>
|
|
SupportTab = 8,
|
|
}
|
|
|
|
/// <summary>
|
|
/// Which automatic entries a perimeter tabbed for support offers (see
|
|
/// <see cref="PreparedContours.WithSupportTab"/>); every other contour offers its whole catalogue.
|
|
/// </summary>
|
|
internal enum SupportEntries
|
|
{
|
|
/// <summary>Entries whose tab steadies the part, clear of inside corners, plus its best tab point.</summary>
|
|
Steadying,
|
|
|
|
/// <summary>Every entry clear of inside corners: the fallback when no steadying entry fits.</summary>
|
|
ClearOfInsideCorners,
|
|
|
|
/// <summary>Every entry: the last fallback, when nothing clear of inside corners fits.</summary>
|
|
Any,
|
|
}
|
|
|
|
/// <summary>
|
|
/// One automatic start candidate: the owned contour choice plus its preference kind and a
|
|
/// stable geometry tie key for deterministic ranking. The choice keeps this preparation as
|
|
/// owner; nothing here exposes or mutates the underlying shape.
|
|
/// </summary>
|
|
internal sealed record ContourEntryCandidate(ContourChoice Choice, AutomaticEntryKind Kind)
|
|
{
|
|
/// <summary>
|
|
/// Stable geometric tie key: the point quantized to the preparation epsilon grid, so
|
|
/// equal points rank together regardless of the entity that produced them.
|
|
/// </summary>
|
|
internal (long X, long Y) GeometryKey => (Quantize(Choice.Point.X), Quantize(Choice.Point.Y));
|
|
|
|
private static long Quantize(double value) =>
|
|
(long)System.Math.Round(value / PostVerificationGeometry.Epsilon);
|
|
}
|