mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-12-03 03:09:25 -05:00
A part bent two ways listed its bend groups in the label box, which did not say which bend was which. Each bend now gets its own circled letter beside its line, just past the band the bend rolls through, on either side and at the largest of the label text sizes that fits. The letters need no label box, so the box holds the part number only and the groups are no longer etched in it. The nest's units size the letters, so Plan Cutting callers pass them. The CAD Converter previews the letters for any part with bends. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
114 lines
5.3 KiB
C#
114 lines
5.3 KiB
C#
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();
|
|
|
|
/// <summary>
|
|
/// 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.
|
|
/// </summary>
|
|
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;
|
|
|
|
/// <summary>
|
|
/// 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.
|
|
/// </summary>
|
|
public double PierceDiameter { get; set; }
|
|
|
|
/// <summary>The pierce zone's radius, or 0 when <see cref="PierceDiameter"/> is off.</summary>
|
|
public double GetPierceZoneRadius() =>
|
|
PierceDiameter > 0 && double.IsFinite(PierceDiameter) ? PierceDiameter / 2 : 0;
|
|
|
|
/// <summary>The clearance a pierce keeps from its own contour: the larger setting wins.</summary>
|
|
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; }
|
|
|
|
/// <summary>
|
|
/// 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.
|
|
/// </summary>
|
|
public bool TabsEnabled { get; set; }
|
|
|
|
/// <summary>
|
|
/// Tabs the parts that need one (see docs/support-tabs.md): with <see cref="TabBySize"/>
|
|
/// 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 <see cref="TabConfig"/> for the tab size.
|
|
/// </summary>
|
|
public bool SupportTabs { get; set; }
|
|
|
|
/// <summary>
|
|
/// With <see cref="SupportTabs"/>, ignore the support bed and tab every part whose width is
|
|
/// in <see cref="TabSizeMinWidth"/> to <see cref="TabSizeMaxWidth"/>
|
|
/// (<see cref="TabsBySizeAt"/>).
|
|
/// </summary>
|
|
public bool TabBySize { get; set; }
|
|
|
|
/// <summary>
|
|
/// The narrowest part width that is tabbed by size: with <see cref="TabBySize"/>, or with
|
|
/// <see cref="SupportTabs"/> on a plate that has no support bed (see <see cref="TabsBySizeAt"/>).
|
|
/// </summary>
|
|
public double TabSizeMinWidth { get; set; }
|
|
|
|
/// <summary>
|
|
/// The widest part width that is tabbed by size; 0 turns the rule off, so nothing is
|
|
/// tabbed by size.
|
|
/// </summary>
|
|
public double TabSizeMaxWidth { get; set; }
|
|
|
|
/// <summary>Whether <see cref="TabSizeMinWidth"/> to <see cref="TabSizeMaxWidth"/> is a usable range.</summary>
|
|
public bool HasTabSizeRange() =>
|
|
TabSizeMaxWidth > 0 && double.IsFinite(TabSizeMaxWidth)
|
|
&& TabSizeMinWidth >= 0 && TabSizeMinWidth <= TabSizeMaxWidth;
|
|
|
|
/// <summary>
|
|
/// Whether a part <paramref name="width"/> wide (the short side of its minimum-area
|
|
/// bounding rectangle) is tabbed by size.
|
|
/// </summary>
|
|
public bool TabsBySizeAt(double width) =>
|
|
HasTabSizeRange()
|
|
&& width >= TabSizeMinWidth - Math.Tolerance.Epsilon
|
|
&& width <= TabSizeMaxWidth + Math.Tolerance.Epsilon;
|
|
|
|
/// <summary>
|
|
/// Slices the slug of each cutout its plate's support bed cannot hold level along the
|
|
/// bed's slice 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
|
|
/// <see cref="Kerf"/> short of the cutout, so nothing is sliced without a kerf.
|
|
/// </summary>
|
|
public bool SliceTippingSlugs { get; set; }
|
|
|
|
/// <summary>
|
|
/// Etches each part's number in its drawing's label box, with or without each bend's group
|
|
/// letter beside its bend line, when cutting is planned (see docs/label-box.md). Off by
|
|
/// default; a drawing with no label box gets no number, and common-line members get nothing.
|
|
/// </summary>
|
|
public PartLabelMode LabelMode { get; set; }
|
|
|
|
public SequenceParameters Sequencing { get; set; } = new SequenceParameters();
|
|
public AssignmentParameters Assignment { get; set; } = new AssignmentParameters();
|
|
}
|
|
}
|