mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-24 20:47:42 -05:00
Replace the on/off CuttingParameters.EtchPartLabels with a PartLabelMode (Off, PartNumber, PartNumberAndBendGroups), chosen from a dropdown in the Cutting panel and kept per machine thickness. PartNumber etches only the drawing name; the full mode keeps the 1234-AB label. Settings saved with the old boolean still load: true reads as PartNumberAndBendGroups and false or a missing key as Off, in the cutting parameter DTO and the machine thickness config. The old key is never written again. The plan fingerprint keeps the old full-label token and adds one for the number-only mode. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
65 lines
2.8 KiB
C#
65 lines
2.8 KiB
C#
using System.Text.Json;
|
|
using System.Text.Json.Serialization;
|
|
using OpenNest.CNC.CuttingStrategy;
|
|
|
|
namespace OpenNest.Data;
|
|
|
|
/// <summary>
|
|
/// The Cutting Parameters dialog's settings beyond leads for one thickness: lead-in angle
|
|
/// rounding, tabs and pierce. Lengths are in the machine's units. A thickness without them
|
|
/// (<see cref="ThicknessConfig.Cutting"/> null) takes this PC's last cutting settings.
|
|
/// </summary>
|
|
public class ThicknessCuttingConfig
|
|
{
|
|
public bool RoundLeadInAngles { get; set; }
|
|
public double LeadInAngleIncrement { get; set; } = 5;
|
|
|
|
/// <summary>Whether parts are tabbed at all: by the support grid, or by size with <see cref="TabBySize"/>.</summary>
|
|
public bool Tabs { get; set; }
|
|
|
|
/// <summary>With <see cref="Tabs"/>, ignore the support grid and tab parts whose narrow side is in the size range.</summary>
|
|
public bool TabBySize { get; set; }
|
|
|
|
public double TabSize { get; set; } = 0.03;
|
|
|
|
/// <summary>The longest part its tab alone holds; 0 turns the rule off.</summary>
|
|
public double TabHeldMaxLength { get; set; } = 6;
|
|
|
|
public double TabSizeMinWidth { get; set; }
|
|
|
|
/// <summary>The widest part tabbed by size; 0 tabs nothing by size.</summary>
|
|
public double TabSizeMaxWidth { get; set; }
|
|
|
|
/// <summary>Whether cutouts the support grid can't hold level have their slugs sliced; written only when on.</summary>
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
|
public bool SliceTippingSlugs { get; set; }
|
|
|
|
/// <summary>What Plan Cutting etches in each part's label box; written only when not off.</summary>
|
|
[JsonConverter(typeof(JsonStringEnumConverter))]
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
|
public PartLabelMode LabelMode { get; set; }
|
|
|
|
/// <summary>
|
|
/// 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 <see cref="PartLabelMode.PartNumberAndBendGroups"/>.
|
|
/// </summary>
|
|
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
|
public bool EtchPartLabels { get; set; }
|
|
|
|
/// <summary><see cref="LabelMode"/>, or the full label when only the old on/off option is set.</summary>
|
|
[JsonIgnore]
|
|
public PartLabelMode ResolvedLabelMode =>
|
|
LabelMode != PartLabelMode.Off ? LabelMode
|
|
: EtchPartLabels ? PartLabelMode.PartNumberAndBendGroups
|
|
: PartLabelMode.Off;
|
|
|
|
public double PierceClearance { get; set; } = 0.0625;
|
|
|
|
/// <summary>The pierce zone's diameter; 0 turns it off.</summary>
|
|
public double PierceDiameter { get; set; }
|
|
|
|
/// <summary>Fields a newer OpenNest wrote, kept so saving here does not drop them.</summary>
|
|
[JsonExtensionData]
|
|
public Dictionary<string, JsonElement>? Unknown { get; set; }
|
|
}
|