mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-30 06:41:34 -05:00
fix(cutting): let a part no tab can steady leave from another entry
A support-tabbed part that no single tab can hold level was limited to its one steadiest entry. Two strips stacked in a frame's cutout then blocked the plate: from the upper strip's only entry, every route to the lower one crossed holes already cut. Its other entries clear of inside corners now follow the steadiest, in the search and in contour recovery; the part is still tabbed and still warned about. Parts a tab can hold keep their steadying entries. The unverified headline also named fixed lead-ins when the only warning was a part that may tip; it now says what needs review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e0bc97a719
commit
b2cc796e4a
5 files changed
+125
-3
No files matched your search
@@ -491,7 +491,7 @@ public sealed class CuttingPlanProposal
|
||||
+ $"{Count(Plates.Sum(p => p.RegeneratedCount), "part program")} regenerated.");
|
||||
else if (RequiresWarningAcceptance)
|
||||
lines.Add((Plates.All(p => p.IsReady || p.HasOnlyFixedLeadWarnings)
|
||||
? "Unverified plan available: fixed lead-ins could not be certified. "
|
||||
? "Unverified plan available: " + Unverified(Plates.Where(p => !p.IsReady)).Headline + " "
|
||||
: Plates.Any(p => p.Result.IsSafestRouteFallback)
|
||||
? "Safest-route plan available: no route passed every check within the search limit. "
|
||||
: "Best-effort plan available. ")
|
||||
@@ -509,6 +509,19 @@ public sealed class CuttingPlanProposal
|
||||
return lines;
|
||||
}
|
||||
|
||||
// What an unverified plan whose motions all passed asks the operator to review: its fixed
|
||||
// lead-ins, parts its support bed cannot hold level, or both.
|
||||
private static (string Headline, string Plate) Unverified(IEnumerable<CuttingPlanPlateResult> plates)
|
||||
{
|
||||
var kinds = plates.SelectMany(p => p.Result.Findings).Select(f => f.Kind).Where(k => k != null).ToHashSet();
|
||||
return kinds.Count == 1 && kinds.Contains(PostVerificationKind.PartSupport)
|
||||
? ("a part may tip once cut free.", "a part may tip once cut free.")
|
||||
: kinds.Contains(PostVerificationKind.PartSupport)
|
||||
? ("fixed lead-ins could not be certified, and a part may tip once cut free.",
|
||||
"fixed lead-ins need review, and a part may tip once cut free.")
|
||||
: ("fixed lead-ins could not be certified.", "fixed lead-ins need review.");
|
||||
}
|
||||
|
||||
private static IEnumerable<string> DescribePlate(CuttingPlanPlateResult plate, string unit, string changeSettings)
|
||||
{
|
||||
var heading = $"Plate {plate.PlateNumber}: ";
|
||||
@@ -541,7 +554,7 @@ public sealed class CuttingPlanProposal
|
||||
if (plate.CanApplyWithWarnings)
|
||||
{
|
||||
yield return heading + (plate.HasOnlyFixedLeadWarnings
|
||||
? $"unverified: fixed lead-ins need review. {Count(plate.PartCount, "part")}, "
|
||||
? $"unverified: {Unverified([plate]).Plate} {Count(plate.PartCount, "part")}, "
|
||||
+ $"{plate.RegeneratedCount} regenerated; every planned motion passed its checks."
|
||||
: result.SafestRoute is { } severity
|
||||
? $"safest route found, unverified. No route passed every check within the search limit; "
|
||||
|
||||
@@ -739,8 +739,16 @@ internal static class JointCuttingPlanSearch
|
||||
{
|
||||
// Placement origins are authored program coordinates, not a downstream cut.
|
||||
// Use the same material-center look-ahead as the retained entry search.
|
||||
var toward = target ?? node.RoutePosition - source.Location;
|
||||
var ranked = prepared.AutomaticEntryCandidatesWithFallbacks(prepared.PerimeterOrdinal, token: token)
|
||||
.OrderBy(c => c.Choice.Point.DistanceTo(target ?? node.RoutePosition - source.Location)).ToArray();
|
||||
.OrderBy(c => c.Choice.Point.DistanceTo(toward)).ToArray();
|
||||
// As in SelectEntries: when no single tab can steady the part, its other entries
|
||||
// clear of inside corners follow the steadiest.
|
||||
if (prepared.HasSupportTab && prepared.Support is { TabCanSupport: false })
|
||||
ranked = [.. ranked, .. prepared.AutomaticEntryCandidatesWithFallbacks(prepared.PerimeterOrdinal,
|
||||
token: token, supportEntries: SupportEntries.ClearOfInsideCorners)
|
||||
.Where(c => !ranked.Any(r => r.Choice.Point.DistanceTo(c.Choice.Point) <= OpenNest.Math.Tolerance.Epsilon))
|
||||
.OrderBy(c => c.Choice.Point.DistanceTo(toward))];
|
||||
perimeters = ranked.Where(c => Evaluate(source, c).Status == ContourFeasibilityStatus.Clear)
|
||||
.Select(c => c.Choice).ToArray();
|
||||
if (perimeters.Length == 0)
|
||||
@@ -1260,6 +1268,25 @@ internal static class JointCuttingPlanSearch
|
||||
selection = Steadiest(source.Prepared, ContourEntrySelection.Select(ordered,
|
||||
candidate => Evaluate(source, candidate), snapshot.MaxEntries, token));
|
||||
}
|
||||
// When no single tab can steady the part, its steadiest entry is only a preference:
|
||||
// the other entries clear of inside corners follow it, steadiest first, so a part
|
||||
// boxed in by its neighbors can still be left toward the next cut.
|
||||
if (contour == source.Prepared.PerimeterOrdinal && source.Prepared.HasSupportTab
|
||||
&& source.Prepared.Support is { TabCanSupport: false }
|
||||
&& (selection.Choices.Count != 0 || selection.UncertainChoices.Count != 0))
|
||||
{
|
||||
var others = ContourEntrySelection.Select(
|
||||
RankedEntries(source, contour, target, arrival, sightTargets, SupportEntries.ClearOfInsideCorners),
|
||||
candidate => Evaluate(source, candidate), snapshot.MaxEntries, token);
|
||||
var kept = selection.Choices.Concat(selection.UncertainChoices).ToArray();
|
||||
bool IsNew(ContourChoice choice) =>
|
||||
!kept.Any(k => k.Point.DistanceTo(choice.Point) <= OpenNest.Math.Tolerance.Epsilon);
|
||||
selection = selection with
|
||||
{
|
||||
Choices = selection.Choices.Concat(others.Choices.Where(IsNew)).ToArray(),
|
||||
UncertainChoices = selection.UncertainChoices.Concat(others.UncertainChoices.Where(IsNew)).ToArray(),
|
||||
};
|
||||
}
|
||||
// No configured lead-in fits a cutout: pierce where eroding it leaves room.
|
||||
string erodedReason = null;
|
||||
// Entries the check could not settle are no fit either: a clear pierce outranks them.
|
||||
|
||||
Reference in new issue
Block a user