Files
OpenNest/OpenNest.IO/CuttingParametersDto.cs
T
ajandClaude Opus 5.5 9315d7394c feat(planner): heat start limit replaces the heat weight
Plan Cutting's heat-aware order is now one setting, "Don't start above (°C
rise)" (CuttingParameters.HeatStartLimit, 0 = off, saved per material and
thickness), with the same rule for single parts and for the lines of large
grids: before each next piece, estimate the temperature where it starts when
the tool gets there; cut the plain order's next piece when it is at or under
the limit, else the nearest piece under it, else the coolest. A move across
parts already cut is a heat jump, reached with the head raised and counted in
HeatRaises; parts that cannot take a raise are reached head-down only when
nothing else is ready. The weighted block layouts and the grid prototype's
static switch and Alternate mode are gone; every-other-line on the washer
grid falls out of the rule.

The rule counts the heat of the part just cut: leaving it out halved the
raises on a 0.06 in sheet but left the starts' P90 at 32-36 C instead of
about 3 C. Re-plans after a learned order rule replay the parts already cut
into the estimate and the crossing test, and an order the heat never moved
stays the plain one, so a limit the estimate never reaches changes nothing.

Measured (HeatOrderMeasurementTests, docs/plate-heat-map.md): washer grid
line starts 63 -> 6 C for +1.5% travel and 1-2 raises; 0.06 in sheet zone
P95 -25% for +10-15% travel, +2% cut time; 0.25 in sheet at 10 C zone P95
-18% for +15% travel (the old weight: -10% for +51%). No fallback raises.
Limit 0 is byte-identical (characterization digests, problem-nest
part-order and grid areas pass).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 23:42:47 -05:00

106 lines
4.9 KiB
C#

using OpenNest.CNC.CuttingStrategy;
namespace OpenNest.IO;
/// <summary>
/// JSON-safe cutting parameters shared by nest files and desktop settings.
/// Lead and tab discriminators avoid serializing abstract domain types.
/// </summary>
public class CuttingParametersDto
{
public int Id { get; set; }
public string MachineName { get; set; }
public string MaterialName { get; set; }
public string Grade { get; set; }
public double Thickness { get; set; }
public double Kerf { get; set; }
public double PartSpacing { get; set; }
public LeadInDto ExternalLeadIn { get; set; }
public LeadOutDto ExternalLeadOut { get; set; }
public LeadInDto InternalLeadIn { get; set; }
public LeadOutDto InternalLeadOut { get; set; }
// Older files also stored arcCircleLeadIn/arcCircleLeadOut. Circles now use the internal
// leads, so those keys are ignored on read and no longer written.
public bool TabsEnabled { get; set; }
// Legacy settings only stored tabWidth. A missing TabConfig uses that width;
// Type = "None" explicitly records a null tab in a nest parameter snapshot.
public double TabWidth { get; set; }
public TabDto TabConfig { get; set; }
public double PierceClearance { get; set; }
public double PierceDiameter { get; set; }
public bool RoundLeadInAngles { get; set; }
public double LeadInAngleIncrement { get; set; }
public bool SupportTabs { get; set; }
public bool TabBySize { get; set; }
// The size range's JSON keys keep their names from when only plates with no support bed used it.
public double NoBedTabMinWidth { get; set; }
public double NoBedTabMaxWidth { get; set; }
// Written only when on, so files and settings saved without it are unchanged.
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)]
public bool SliceTippingSlugs { get; set; }
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))]
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)]
public PartLabelMode LabelMode { get; set; }
// Written only when set, so files and settings saved without it are unchanged.
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)]
public double HeatStartLimit { get; set; }
// Read only: the old on/off part label option, which meant the number with its bend groups.
// Never written; files saved with it load as PartNumberAndBendGroups.
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)]
public bool EtchPartLabels { get; set; }
/// <summary>
/// <see cref="LabelMode"/>, or the full label when only the old on/off option is set. A number
/// that names no mode (the reader accepts numbers) loads as the old option, so as Off without it.
/// </summary>
[System.Text.Json.Serialization.JsonIgnore]
public PartLabelMode ResolvedLabelMode =>
LabelMode != PartLabelMode.Off && System.Enum.IsDefined(LabelMode) ? LabelMode
: EtchPartLabels ? PartLabelMode.PartNumberAndBendGroups
: PartLabelMode.Off;
public class LeadInDto
{
public string Type { get; set; } = "None";
public double Length { get; set; }
public double ApproachAngle { get; set; }
public double Radius { get; set; }
// Absent from files written before arc lead-ins had a sweep: they were half circles.
public double SweepAngle { get; set; } = ArcLeadIn.DefaultSweepAngle;
public double LineLength { get; set; }
public double ArcRadius { get; set; }
public double Kerf { get; set; }
public double Length1 { get; set; }
public double Angle1 { get; set; }
public double Length2 { get; set; }
public double Angle2 { get; set; }
}
public class LeadOutDto
{
public string Type { get; set; } = "None";
public double Length { get; set; }
public double ApproachAngle { get; set; }
public double Radius { get; set; }
public double GapSize { get; set; }
}
public class TabDto
{
public string Type { get; set; } = "None";
public double Size { get; set; }
public LeadInDto TabLeadIn { get; set; }
public LeadOutDto TabLeadOut { get; set; }
public double CutoutMinWidth { get; set; }
public double CutoutMinHeight { get; set; }
public double CutoutMaxWidth { get; set; }
public double CutoutMaxHeight { get; set; }
public int MachineTabId { get; set; }
public double BreakerDepth { get; set; }
public double BreakerLeadInLength { get; set; }
public double BreakerAngle { get; set; }
}
}