Files
OpenNest/OpenNest.Data/MotionConfig.cs
T
ajandClaude Opus 5.5 3cd7729d38 feat(cutting): keep cutting settings per machine material and thickness
Tabs suit thin plate, but on anything thicker than 0.25 in the parts
are too hard to break out of the sheet, and the Cutting Parameters
dialog was one global set for every job. Its settings now live on the
nest's machine thickness: leads on the existing Outside/Inside Cuts
tabs, and lead-in angle rounding, tabs and pierce on a new Tabs &
Pierce tab (ThicknessConfig.Cutting). In Database mode every
workstation gets the same settings through the shared machine.

The dialog and the Place Lead-in panel say what they edit, and save
back to that thickness (MachineCuttingDefaults.WriteTo, converted to
the machine's units). A thickness with no Tabs & Pierce of its own, or
a nest the machine has no thickness for, keeps this PC's settings as
before. If the machine can't be saved (server offline, a conflict),
the edit is kept on this PC for that job and the user is told.
Machine Configuration can copy one thickness's Tabs & Pierce to
thinner or thicker ones, so the 0.25 in rule takes a few clicks.

An older desktop saving a shared machine would silently erase these
settings, since it doesn't know them. Machine configuration classes
now keep unknown fields, and the server refuses a machine save that
leaves out a field the stored machine has a value for, telling the
user to update OpenNest.

The Plan Cutting status line now reports tabs from SupportTabs; since
"Tab every part" was retired it always said off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 08:24:39 -05:00

47 lines
1.9 KiB
C#

namespace OpenNest.Data;
/// <summary>
/// A machine's acceleration limits for cut-time estimates, in the machine's units
/// (in/s² or mm/s², and in or mm for the corner deviation).
/// </summary>
public class MotionConfig
{
private const double MillimetersPerInch = 25.4;
public double CutAcceleration { get; set; }
public double RapidAcceleration { get; set; }
public double CornerDeviation { get; set; }
/// <summary>
/// Stand-in limits for a machine whose controller values are not on file yet: about
/// 0.5 G cutting, 1 G travel and a 0.001 in (0.025 mm) corner deviation. Replace them
/// with the controller's own settings.
/// </summary>
public static MotionConfig Placeholder(UnitSystem units) =>
units == UnitSystem.Millimeters
? new MotionConfig { CutAcceleration = 4900, RapidAcceleration = 9800, CornerDeviation = 0.025 }
: new MotionConfig { CutAcceleration = 193, RapidAcceleration = 386, CornerDeviation = 0.001 };
/// <summary>These limits converted from <paramref name="from"/> to the nest's <paramref name="to"/> units.</summary>
public MotionProfile ToProfile(UnitSystem from, Units to)
{
var scale = (from, to) switch
{
(UnitSystem.Inches, Units.Millimeters) => MillimetersPerInch,
(UnitSystem.Millimeters, Units.Inches) => 1 / MillimetersPerInch,
_ => 1,
};
return new MotionProfile
{
CutAcceleration = CutAcceleration * scale,
RapidAcceleration = RapidAcceleration * scale,
CornerDeviation = CornerDeviation * scale,
};
}
/// <summary>Fields a newer OpenNest wrote, kept so saving here does not drop them.</summary>
[System.Text.Json.Serialization.JsonExtensionData]
public Dictionary<string, System.Text.Json.JsonElement>? Unknown { get; set; }
}