Files
OpenNest/OpenNest.Desktop/CutTimeEntry.cs
T
ajandClaude Opus 5.5 6cb56a6afd feat(desktop): share the cut-time report and cut simulation playhead
CutTimeReport computes and words what Calculate Cut Time shows for a plate
or nest (time from the simulation with acceleration plus clamp removal,
distances and counts from the timing info) as the WinForms timing window.
CutTimeEntry and CutTimeMachineChoice hold the dialog's box ranges, the
entered values' cut parameters and the Acceleration list's entries.
CutSimulationPlayback is the simulator's playhead without drawing: play,
pause and speed, scrubbing, part, cutout and move stepping, retiming that
keeps the torch in place and which parts it has not reached;
CutSimulationStatus words its status rows.

The WinForms timing window, cut parameters dialog, machine box, simulator
and overlay now call them; their behavior is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 18:45:44 -05:00

40 lines
1.5 KiB
C#

using System;
using OpenNest.Data;
namespace OpenNest.Desktop;
/// <summary>
/// The cut-time values entered in Calculate Cut Time or the simulator, with the ranges their
/// WinForms boxes take: feeds and rapid from 1 to 9999 per time unit, pierce seconds from 0 to
/// 100 in the dialog and to 999 in the simulator.
/// </summary>
public static class CutTimeEntry
{
public const decimal MinimumRate = 1;
public const decimal MaximumRate = 9999;
public const decimal DialogMaximumPierce = 100;
public const decimal SimulatorMaximumPierce = 999;
/// <summary>A value shown in a box from <paramref name="minimum"/> to <paramref name="maximum"/>.</summary>
public static decimal Clamp(double value, decimal minimum, decimal maximum) =>
System.Math.Clamp((decimal)value, minimum, maximum);
/// <summary>
/// The parameters the entered values time with in <paramref name="units"/>, with
/// <paramref name="machine"/>'s acceleration (null for full speed).
/// </summary>
public static CutParameters Parameters(
decimal feed, decimal holeFeed, decimal rapid, decimal pierceSeconds, bool skipEtch,
Units units, MachineConfig machine) =>
new()
{
Feedrate = (double)feed,
HoleFeedrate = (double)holeFeed,
RapidTravelRate = (double)rapid,
PierceTime = TimeSpan.FromSeconds((double)pierceSeconds),
SkipScribe = skipEtch,
Units = units,
Motion = CutTimeMachineChoice.Motion(machine, units),
};
}