namespace OpenNest.CNC.CuttingStrategy
{
public class CuttingParameters
{
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 LeadIn ExternalLeadIn { get; set; } = new NoLeadIn();
public LeadOut ExternalLeadOut { get; set; } = new NoLeadOut();
///
/// The lead-in of every cutout, full circles included; circles still get their own
/// geometry handling (radius clamp, angle rounding) when the lead is emitted.
///
public LeadIn InternalLeadIn { get; set; } =
new LineLeadIn { Length = 0.125, ApproachAngle = 90 };
public LeadOut InternalLeadOut { get; set; } = new NoLeadOut();
public double PierceClearance { get; set; } = 0.0625;
///
/// Diameter of the crater a pierce blows through this plate; 0 turns the pierce zone off.
/// When set, every lead-in pierce must keep half of it from all part material.
///
public double PierceDiameter { get; set; }
/// The pierce zone's radius, or 0 when is off.
public double GetPierceZoneRadius() =>
PierceDiameter > 0 && double.IsFinite(PierceDiameter) ? PierceDiameter / 2 : 0;
/// The clearance a pierce keeps from its own contour: the larger setting wins.
public double GetEffectivePierceClearance() => System.Math.Max(PierceClearance, GetPierceZoneRadius());
public bool RoundLeadInAngles { get; set; }
public double LeadInAngleIncrement { get; set; } = 5.0;
public Tab TabConfig { get; set; }
///
/// Whether a contour is cut with a tab at its entry. The cutting settings never set it for
/// every part: Plan Cutting, Place Lead-in and drawing pins set it on the copies of the
/// settings they give the parts they tab. Parameters recorded with it on replay as planned.
///
public bool TabsEnabled { get; set; }
///
/// Tabs the parts that need one (see docs/support-tabs.md): with
/// off, each part its plate's support bed cannot hold level once it is cut free, at the
/// perimeter point that best keeps its center of gravity over the bed's contacts, or on a
/// plate with no bed each part in the size range; with it on, each part in the size range.
/// Needs for the tab size.
///
public bool SupportTabs { get; set; }
///
/// With , ignore the support bed and tab every part whose width is
/// in to
/// ().
///
public bool TabBySize { get; set; }
///
/// The narrowest part width that is tabbed by size: with , or with
/// on a plate that has no support bed (see ).
///
public double TabSizeMinWidth { get; set; }
///
/// The widest part width that is tabbed by size; 0 turns the rule off, so nothing is
/// tabbed by size.
///
public double TabSizeMaxWidth { get; set; }
/// Whether to is a usable range.
public bool HasTabSizeRange() =>
TabSizeMaxWidth > 0 && double.IsFinite(TabSizeMaxWidth)
&& TabSizeMinWidth >= 0 && TabSizeMinWidth <= TabSizeMaxWidth;
///
/// Whether a part wide (the short side of its minimum-area
/// bounding rectangle) is tabbed by size.
///
public bool TabsBySizeAt(double width) =>
HasTabSizeRange()
&& width >= TabSizeMinWidth - Math.Tolerance.Epsilon
&& width <= TabSizeMaxWidth + Math.Tolerance.Epsilon;
///
/// With on a plate with a support bed, the longest part (the
/// long side of its outline's minimum-area bounding rectangle) its tab alone holds: such a
/// part the bed cannot hold level is tabbed, and any tab clear of inside corners steadies
/// it. 0 turns the rule off. New settings start at 6; settings saved without it read as 0.
///
public double TabHeldMaxLength { get; set; } = 6;
/// Whether a part long is held by its tab alone (see ).
public bool TabHoldsAt(double length) =>
TabHeldMaxLength > 0 && double.IsFinite(TabHeldMaxLength)
&& length <= TabHeldMaxLength + Math.Tolerance.Epsilon;
///
/// Slices the slug of each cutout its plate's support bed cannot hold level along the
/// bed's contact lines before the cutout is cut, so the slug drops as pieces between the
/// supports instead of tipping (see docs/support-tabs.md#slug-slices). Each slice stops
/// short of the cutout, so nothing is sliced without a kerf.
///
public bool SliceTippingSlugs { get; set; }
public SequenceParameters Sequencing { get; set; } = new SequenceParameters();
public AssignmentParameters Assignment { get; set; } = new AssignmentParameters();
}
}