mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-23 12:27:41 -05:00
feat(cutting): lay Cutting Parameters out side by side; hold every tabbed part by its tab
The Cutting Parameters dialog had grown taller than many screens. It now
puts the leads in a column of their own beside Tabs, Cutouts, Marks and
Pierce (about 780 x 580 instead of 410 x 985). The Place Lead-in side
panel and Machine Configuration keep the single stacked column. The tab
size range is one "Narrow side from ... to ..." row, with its details in
tooltips.
Since e1ccd692 every tabbed part counts as steady, but "Tab alone holds
parts up to" (TabHeldMaxLength, default 6) still picked short parts' tab
points from the center-of-gravity line and treated every tab as equally
steady in the last-resort entry fallback. The setting is removed: every
part the support grid cannot hold level is tabbed and held by its tab,
however long it is. Settings and nests saved with the old value read
unchanged and ignore it.
The problem-nest corpus (entries, every nest) plans identically to master.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
75570a9475
commit
83181570bd
21 files changed
+151
-225
No files matched your search
@@ -45,7 +45,6 @@ internal static class OwnedCuttingParameters
|
||||
TabBySize = source.TabBySize,
|
||||
TabSizeMinWidth = Dimension(source.TabSizeMinWidth),
|
||||
TabSizeMaxWidth = Dimension(source.TabSizeMaxWidth),
|
||||
TabHeldMaxLength = Dimension(source.TabHeldMaxLength),
|
||||
SliceTippingSlugs = source.SliceTippingSlugs,
|
||||
LabelMode = source.LabelMode,
|
||||
Sequencing = new SequenceParameters
|
||||
|
||||
@@ -93,7 +93,6 @@ internal static class StateFingerprint
|
||||
Flag(p.TabBySize);
|
||||
Number(p.TabSizeMinWidth);
|
||||
Number(p.TabSizeMaxWidth);
|
||||
Number(p.TabHeldMaxLength);
|
||||
// Only when on, so fingerprints taken before the setting existed still match.
|
||||
if (p.SliceTippingSlugs)
|
||||
text.Append("slugSlices;");
|
||||
|
||||
@@ -92,19 +92,6 @@ namespace OpenNest.CNC.CuttingStrategy
|
||||
&& width >= TabSizeMinWidth - Math.Tolerance.Epsilon
|
||||
&& width <= TabSizeMaxWidth + Math.Tolerance.Epsilon;
|
||||
|
||||
/// <summary>
|
||||
/// With <see cref="SupportTabs"/> 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.
|
||||
/// </summary>
|
||||
public double TabHeldMaxLength { get; set; } = 6;
|
||||
|
||||
/// <summary>Whether a part <paramref name="length"/> long is held by its tab alone (see <see cref="TabHeldMaxLength"/>).</summary>
|
||||
public bool TabHoldsAt(double length) =>
|
||||
TabHeldMaxLength > 0 && double.IsFinite(TabHeldMaxLength)
|
||||
&& length <= TabHeldMaxLength + Math.Tolerance.Epsilon;
|
||||
|
||||
/// <summary>
|
||||
/// 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
|
||||
|
||||
@@ -104,14 +104,12 @@ internal static class PartSupportReview
|
||||
{
|
||||
var held = !support.HasBed
|
||||
? FormattableString.Invariant($"is {support.Width:0.####} wide, in the width range tabbed by size,")
|
||||
: support.IsHeldByTab
|
||||
? FormattableString.Invariant($"is {support.Length:0.####} long, short enough for its tab alone to hold,")
|
||||
: support.Margin == double.NegativeInfinity
|
||||
? "rests on no support contact"
|
||||
: support.Margin < 0
|
||||
? FormattableString.Invariant($"has its center of gravity {-support.Margin:0.####} outside its support contacts")
|
||||
: FormattableString.Invariant($"has its center of gravity only {support.Margin:0.####} inside its support contacts");
|
||||
var needs = support.HasBed && !support.IsHeldByTab
|
||||
var needs = support.HasBed
|
||||
? FormattableString.Invariant($" (needs {support.RequiredMargin:0.####})") : "";
|
||||
return $"The part {held}{needs} and it has no tab; it may tip once cut free."
|
||||
+ (support.BestTabPoint is { } suggested
|
||||
|
||||
@@ -106,23 +106,8 @@ namespace OpenNest.Support
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The part's length: the long side of its outline's minimum-area bounding rectangle, or
|
||||
/// NaN when its material could not be read.
|
||||
/// </summary>
|
||||
public static double Length(SupportMaterial material)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(material);
|
||||
if (!material.IsComplete || material.Outline.Count < 3)
|
||||
return double.NaN;
|
||||
var box = BoundingRectangle(material.Outline);
|
||||
return System.Math.Max(box.Width, box.Height);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <paramref name="support"/>, a bed analysis of a part the bed cannot hold level, for a
|
||||
/// part short enough for its tab alone to hold
|
||||
/// (<see cref="CNC.CuttingStrategy.CuttingParameters.TabHoldsAt"/>): its contacts and
|
||||
/// margin are kept, any tab clear of inside corners steadies it, and the best tab point is
|
||||
/// <paramref name="support"/>, a bed analysis of a part the bed cannot hold level, for the
|
||||
/// part held by its support tab: its contacts and margin are kept, any tab clear of inside corners steadies it, and the best tab point is
|
||||
/// chosen as without a bed (<see cref="AnalyzeWithoutBed"/>).
|
||||
/// </summary>
|
||||
public static PartSupport HeldByTab(PartSupport support, SupportMaterial material)
|
||||
@@ -133,7 +118,7 @@ namespace OpenNest.Support
|
||||
return support;
|
||||
var best = BestTabPoint(material.Outline, support.CenterOfGravity, support.InsideCorners,
|
||||
support.InsideCornerClearance, _ => double.PositiveInfinity, out _);
|
||||
return support.WithTabHold(best, Length(material));
|
||||
return support.WithTabHold(best);
|
||||
}
|
||||
|
||||
// The outline point a tab steadies the part most from, by `score`, clear of every inside
|
||||
@@ -447,9 +432,9 @@ namespace OpenNest.Support
|
||||
|
||||
// A part on a plate with no bed, tabbed for its width: it rests on nothing modeled, and a
|
||||
// tab anywhere clear of inside corners is as good as any other.
|
||||
// A copy of `source` held by its tab alone: it keeps its contacts and margin, and any tab
|
||||
// A copy of `source` held by its support tab: it keeps its contacts and margin, and any tab
|
||||
// clear of inside corners steadies it.
|
||||
private PartSupport(PartSupport source, Vector? bestTabPoint, double length)
|
||||
private PartSupport(PartSupport source, Vector? bestTabPoint)
|
||||
{
|
||||
CenterOfGravity = source.CenterOfGravity;
|
||||
Contacts = source.Contacts;
|
||||
@@ -461,10 +446,9 @@ namespace OpenNest.Support
|
||||
BestTabPoint = bestTabPoint;
|
||||
BestTabMargin = double.PositiveInfinity;
|
||||
IsHeldByTab = true;
|
||||
Length = length;
|
||||
}
|
||||
|
||||
internal PartSupport WithTabHold(Vector? bestTabPoint, double length) => new(this, bestTabPoint, length);
|
||||
internal PartSupport WithTabHold(Vector? bestTabPoint) => new(this, bestTabPoint);
|
||||
|
||||
internal PartSupport(Vector centerOfGravity, Vector? bestTabPoint, IReadOnlyList<Vector> insideCorners,
|
||||
double insideCornerClearance, double width)
|
||||
@@ -487,15 +471,11 @@ namespace OpenNest.Support
|
||||
public bool HasBed { get; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// True for a part on a bed that cannot hold it level but short enough for its tab alone
|
||||
/// to hold (<see cref="SupportAnalyzer.HeldByTab"/>): any tab clear of inside corners
|
||||
/// steadies it.
|
||||
/// True for a part on a bed that cannot hold it level, held by its support tab instead
|
||||
/// (<see cref="SupportAnalyzer.HeldByTab"/>): any tab clear of inside corners steadies it.
|
||||
/// </summary>
|
||||
public bool IsHeldByTab { get; }
|
||||
|
||||
/// <summary>The part's length when <see cref="IsHeldByTab"/> (see <see cref="SupportAnalyzer.Length"/>); NaN otherwise.</summary>
|
||||
public double Length { get; } = double.NaN;
|
||||
|
||||
/// <summary>The part's width when analyzed without a bed (see <see cref="SupportAnalyzer.Width"/>); NaN otherwise.</summary>
|
||||
public double Width { get; } = double.NaN;
|
||||
|
||||
|
||||
@@ -35,9 +35,8 @@ namespace OpenNest.Support
|
||||
|
||||
/// <summary>
|
||||
/// The analysis that tabs a part, or null when support tabs are off or the part is
|
||||
/// outside the rule: by the bed, the bed's analysis, held by its tab alone
|
||||
/// (<see cref="SupportAnalyzer.HeldByTab"/>) when the bed cannot hold it level and its
|
||||
/// length is within <see cref="CuttingParameters.TabHoldsAt"/>; by size (no bed, or
|
||||
/// outside the rule: by the bed, the bed's analysis, held by its tab
|
||||
/// (<see cref="SupportAnalyzer.HeldByTab"/>) when the bed cannot hold it level; by size (no bed, or
|
||||
/// <see cref="CuttingParameters.TabBySize"/>), a no-bed analysis
|
||||
/// (<see cref="SupportAnalyzer.AnalyzeWithoutBed"/>) of a part whose width is in
|
||||
/// <see cref="CuttingParameters.TabsBySizeAt"/>'s range. The part needs a tab when
|
||||
@@ -56,7 +55,6 @@ namespace OpenNest.Support
|
||||
{
|
||||
var support = SupportAnalyzer.Analyze(bed, quadrant, material, insideCornerClearance);
|
||||
return support is { IsComplete: true, IsSupported: false }
|
||||
&& parameters.TabHoldsAt(SupportAnalyzer.Length(material))
|
||||
? SupportAnalyzer.HeldByTab(support, material)
|
||||
: support;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,6 @@ public static class MachineCuttingDefaults
|
||||
Tabs = parameters.SupportTabs,
|
||||
TabBySize = parameters.TabBySize,
|
||||
TabSize = (parameters.TabConfig?.Size ?? previous?.TabSize ?? new ThicknessCuttingConfig().TabSize) * scale,
|
||||
TabHeldMaxLength = parameters.TabHeldMaxLength * scale,
|
||||
TabSizeMinWidth = parameters.TabSizeMinWidth * scale,
|
||||
TabSizeMaxWidth = parameters.TabSizeMaxWidth * scale,
|
||||
SliceTippingSlugs = parameters.SliceTippingSlugs,
|
||||
@@ -147,7 +146,6 @@ public static class MachineCuttingDefaults
|
||||
// The thickness's tabs replace any retired "Tab every part" the fallback still carries.
|
||||
parameters.TabsEnabled = false;
|
||||
parameters.TabConfig = new NormalTab { Size = cutting.TabSize * scale };
|
||||
parameters.TabHeldMaxLength = cutting.TabHeldMaxLength * scale;
|
||||
parameters.TabSizeMinWidth = cutting.TabSizeMinWidth * scale;
|
||||
parameters.TabSizeMaxWidth = cutting.TabSizeMaxWidth * scale;
|
||||
parameters.SliceTippingSlugs = cutting.SliceTippingSlugs;
|
||||
|
||||
@@ -22,9 +22,6 @@ public class ThicknessCuttingConfig
|
||||
|
||||
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>
|
||||
|
||||
@@ -81,15 +81,13 @@ internal static class SupportTabCapture
|
||||
var part = source.SourceOrdinal + 1;
|
||||
var held = !support.HasBed
|
||||
? FormattableString.Invariant($"is {support.Width:0.####} wide, in the width range tabbed by size,")
|
||||
: support.IsHeldByTab
|
||||
? FormattableString.Invariant($"is {support.Length:0.####} long, short enough for its tab alone to hold,")
|
||||
: support.Margin == double.NegativeInfinity
|
||||
? "rests on no support contact"
|
||||
: support.Margin < 0
|
||||
? FormattableString.Invariant($"has its center of gravity {-support.Margin:0.####} outside its support contacts")
|
||||
: FormattableString.Invariant($"has its center of gravity only {support.Margin:0.####} inside its support contacts");
|
||||
var why = $"drawing pin {prepared.PinNumberOf(prepared.PerimeterOrdinal)} cuts its outside without a tab";
|
||||
var needs = support.HasBed && !support.IsHeldByTab ? FormattableString.Invariant($" (needs {support.RequiredMargin:0.####})") : "";
|
||||
var needs = support.HasBed ? FormattableString.Invariant($" (needs {support.RequiredMargin:0.####})") : "";
|
||||
return new CuttingPlanFinding(source.SourceOrdinal, source.SourcePart, null, null,
|
||||
PostVerificationKind.PartSupport, $"Part {part} {held}{needs} and {why}; it may tip once cut free.");
|
||||
}
|
||||
|
||||
@@ -122,15 +122,10 @@ public class SupportGridPersistenceTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TabHeldLengthRoundTripsInCuttingParameters()
|
||||
public void SettingsSavedWithTheRetiredTabHeldLengthStillRead()
|
||||
{
|
||||
var parameters = new CuttingParameters { SupportTabs = true, TabHeldMaxLength = 2 };
|
||||
var restored = CuttingParametersSerializer.Deserialize("""{"supportTabs":true,"tabHeldMaxLength":2}""");
|
||||
|
||||
var restored = CuttingParametersSerializer.Deserialize(CuttingParametersSerializer.Serialize(parameters));
|
||||
var snapshot = CuttingParametersSerializer.FromDto(CuttingParametersSerializer.ToDto(parameters));
|
||||
|
||||
Assert.Equal(2, restored.TabHeldMaxLength);
|
||||
Assert.Equal(2, snapshot.TabHeldMaxLength);
|
||||
Assert.Equal(0, CuttingParametersSerializer.Deserialize("{}").TabHeldMaxLength);
|
||||
Assert.True(restored.SupportTabs);
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,6 @@ public class CuttingParametersDto
|
||||
// The size range's JSON keys keep their names from when only plates with no support bed used it.
|
||||
public double NoBedTabMinWidth { get; set; }
|
||||
public double NoBedTabMaxWidth { get; set; }
|
||||
public double TabHeldMaxLength { get; set; }
|
||||
// Written only when on, so files and settings saved without it are unchanged.
|
||||
[System.Text.Json.Serialization.JsonIgnore(Condition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public bool SliceTippingSlugs { get; set; }
|
||||
|
||||
@@ -93,7 +93,6 @@ public static class CuttingParametersSerializer
|
||||
TabBySize = parameters.TabBySize,
|
||||
NoBedTabMinWidth = parameters.TabSizeMinWidth,
|
||||
NoBedTabMaxWidth = parameters.TabSizeMaxWidth,
|
||||
TabHeldMaxLength = parameters.TabHeldMaxLength,
|
||||
SliceTippingSlugs = parameters.SliceTippingSlugs,
|
||||
LabelMode = parameters.LabelMode,
|
||||
Sequencing = ToSequenceDto(parameters.Sequencing),
|
||||
@@ -132,7 +131,6 @@ public static class CuttingParametersSerializer
|
||||
TabBySize = dto.TabBySize,
|
||||
TabSizeMinWidth = dto.NoBedTabMinWidth,
|
||||
TabSizeMaxWidth = dto.NoBedTabMaxWidth,
|
||||
TabHeldMaxLength = dto.TabHeldMaxLength,
|
||||
SliceTippingSlugs = dto.SliceTippingSlugs,
|
||||
LabelMode = dto.ResolvedLabelMode,
|
||||
Sequencing = FromSequenceDto(dto.Sequencing),
|
||||
|
||||
@@ -44,7 +44,6 @@ public class OwnedCuttingParameterTests
|
||||
SupportTabs = true,
|
||||
TabSizeMinWidth = 0.5,
|
||||
TabSizeMaxWidth = 4,
|
||||
TabHeldMaxLength = 2,
|
||||
RoundLeadInAngles = true,
|
||||
LeadInAngleIncrement = 30,
|
||||
Sequencing = new SequenceParameters
|
||||
|
||||
@@ -89,7 +89,6 @@ public class ShortestPathEntryTests
|
||||
var bed = new SupportGrid(2, 2, offsetX: 0.7, stabilityMargin: stabilityMargin);
|
||||
var parameters = Parameters();
|
||||
parameters.SupportTabs = true;
|
||||
parameters.TabHeldMaxLength = 0;
|
||||
var parts = Strips(3);
|
||||
var snapshot = CuttingPlanService.Capture(new CuttingPlanRequest(parts, Start, confirmedParameters: parameters,
|
||||
preservePartOrder: true)
|
||||
|
||||
@@ -39,7 +39,6 @@ public class TutorialNestPlanningTests
|
||||
"test-data", "help-tutorial", "first-nest.nest")).Read();
|
||||
var parameters = CuttingParametersSerializer.Deserialize(Settings);
|
||||
parameters.SupportTabs = supportTabs;
|
||||
parameters.TabHeldMaxLength = new CuttingParameters().TabHeldMaxLength;
|
||||
var plate = nest.Plates[0];
|
||||
Assert.NotNull(plate.SupportBed);
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ public class ThicknessCuttingSettingsTests
|
||||
Tabs = true,
|
||||
TabBySize = true,
|
||||
TabSize = 0.03,
|
||||
TabHeldMaxLength = 4,
|
||||
TabSizeMinWidth = 0.5,
|
||||
TabSizeMaxWidth = 3,
|
||||
PierceClearance = 0.05,
|
||||
@@ -88,7 +87,6 @@ public class ThicknessCuttingSettingsTests
|
||||
Assert.True(thin.SupportTabs);
|
||||
Assert.True(thin.TabBySize);
|
||||
Assert.Equal(0.03, thin.TabConfig.Size);
|
||||
Assert.Equal(4, thin.TabHeldMaxLength);
|
||||
Assert.Equal(0.5, thin.TabSizeMinWidth);
|
||||
Assert.Equal(3, thin.TabSizeMaxWidth);
|
||||
Assert.Equal(0.05, thin.PierceClearance);
|
||||
|
||||
@@ -10,9 +10,8 @@ using OpenNest.Tests.CuttingPlanning;
|
||||
namespace OpenNest.Tests.Support;
|
||||
|
||||
/// <summary>
|
||||
/// Support tabs on a bed for parts short enough for their tab alone to hold
|
||||
/// (<see cref="CuttingParameters.TabHeldMaxLength"/>): a part the bed cannot hold level is still
|
||||
/// tabbed, but any tab clear of inside corners steadies it, so it is not reported.
|
||||
/// Support tabs on a bed: a part the bed cannot hold level is tabbed and held by its tab, however
|
||||
/// long it is, so any tab clear of inside corners steadies it and it is not reported.
|
||||
/// </summary>
|
||||
public class TabHeldSupportTabTests
|
||||
{
|
||||
@@ -21,12 +20,11 @@ public class TabHeldSupportTabTests
|
||||
// A 2 inch laser grid; a 1.5 inch square rests on one of its points at most.
|
||||
private static readonly SupportGrid Bed = new(2, 2, 0, 0, registrationTolerance: 0.125, stabilityMargin: 0.25);
|
||||
|
||||
private static CuttingParameters Parameters(double tabHeldMaxLength)
|
||||
private static CuttingParameters Parameters()
|
||||
{
|
||||
var parameters = ExplicitContourTests.Parameters();
|
||||
parameters.SupportTabs = true;
|
||||
parameters.TabConfig = new NormalTab { Size = TabSize };
|
||||
parameters.TabHeldMaxLength = tabHeldMaxLength;
|
||||
return parameters;
|
||||
}
|
||||
|
||||
@@ -50,16 +48,6 @@ public class TabHeldSupportTabTests
|
||||
return entry.DistanceTo(cutEnd);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(0, false)] // off
|
||||
[InlineData(1, false)]
|
||||
[InlineData(1.5, true)] // the bound is inclusive
|
||||
[InlineData(2, true)]
|
||||
public void TheLimitHoldsPartsUpToIt(double max, bool holdsALengthOfOneAndAHalf)
|
||||
{
|
||||
Assert.Equal(holdsALengthOfOneAndAHalf, new CuttingParameters { TabHeldMaxLength = max }.TabHoldsAt(1.5));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(0)]
|
||||
[InlineData(45)]
|
||||
@@ -68,7 +56,7 @@ public class TabHeldSupportTabTests
|
||||
[InlineData(180)]
|
||||
[InlineData(270)]
|
||||
[InlineData(315)]
|
||||
public void LengthOfATriangleWithTwoLeastBoxes_DoesNotDependOnItsRotation(double degrees)
|
||||
public void WidthOfATriangleWithTwoLeastBoxes_DoesNotDependOnItsRotation(double degrees)
|
||||
{
|
||||
// A 5 x 5 right triangle fits its legs' square and its hypotenuse's 7.07 x 3.54 box, both
|
||||
// of area 25: the squarer box is the one measured, whatever way the part is turned.
|
||||
@@ -78,27 +66,18 @@ public class TabHeldSupportTabTests
|
||||
part.Rotate(degrees * System.Math.PI / 180);
|
||||
var material = SupportMaterial.FromPart(part);
|
||||
|
||||
Assert.Equal(5, SupportAnalyzer.Length(material), 6);
|
||||
Assert.Equal(5, SupportAnalyzer.Width(material), 6);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NewSettingsHoldPartsUpToSixLong()
|
||||
public void Analyze_HoldsAPartTheBedCannotByAnyClearTab()
|
||||
{
|
||||
Assert.Equal(6, new CuttingParameters().TabHeldMaxLength);
|
||||
Assert.True(new CuttingParameters().TabHoldsAt(5));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Analyze_HoldsAShortPartTheBedCannotByAnyClearTab()
|
||||
{
|
||||
var (_, _, part) = Square(Parameters(2));
|
||||
var (_, _, part) = Square(Parameters());
|
||||
var material = SupportMaterial.FromPart(part);
|
||||
|
||||
var held = SupportTabSettings.Analyze(Parameters(2), Bed, 1, material);
|
||||
var bedOnly = SupportTabSettings.Analyze(Parameters(0), Bed, 1, material);
|
||||
var held = SupportTabSettings.Analyze(Parameters(), Bed, 1, material);
|
||||
var bedOnly = SupportAnalyzer.Analyze(Bed, 1, material);
|
||||
|
||||
Assert.Equal(1.5, SupportAnalyzer.Length(material), 6);
|
||||
Assert.False(bedOnly.IsHeldByTab);
|
||||
Assert.False(bedOnly.TabCanSupport);
|
||||
Assert.True(held.IsHeldByTab);
|
||||
@@ -108,41 +87,45 @@ public class TabHeldSupportTabTests
|
||||
Assert.True(held.TabCanSupport);
|
||||
Assert.True(held.AcceptsTabAt(new Vector(3, 3.75)));
|
||||
Assert.True(held.IsSteadiedByTabAt(new Vector(4.5, 3.75)));
|
||||
Assert.False(SupportTabSettings.Analyze(Parameters(1), Bed, 1, material).IsHeldByTab);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Analyze_HoldsALongStripTheBedCannotByItsTab()
|
||||
{
|
||||
// A 12 x 0.5 strip between grid rows rests on no contact at all.
|
||||
var nest = new Nest("strip");
|
||||
var plate = new Plate(20, 20) { CuttingParameters = Parameters() };
|
||||
nest.Plates.Add(plate);
|
||||
nest.SetSupportBed(Bed);
|
||||
var part = new Part(new Drawing("strip", LeadPathValidationTests.Rectangle(0, 0, 12, 0.5)), new Vector(1, 2.75));
|
||||
plate.Parts.Add(part);
|
||||
|
||||
var support = SupportTabSettings.Analyze(Parameters(), Bed, 1, SupportMaterial.FromPart(part));
|
||||
|
||||
Assert.False(support.IsSupported);
|
||||
Assert.True(support.IsHeldByTab);
|
||||
Assert.True(support.TabCanSupport);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Analyze_LeavesAPartTheBedHoldsAlone()
|
||||
{
|
||||
// A 5 inch square rests on a 2 x 2 block of grid points around its center.
|
||||
var (_, _, part) = Square(Parameters(6), 5);
|
||||
var (_, _, part) = Square(Parameters(), 5);
|
||||
|
||||
var support = SupportTabSettings.Analyze(Parameters(6), Bed, 1, SupportMaterial.FromPart(part));
|
||||
var support = SupportTabSettings.Analyze(Parameters(), Bed, 1, SupportMaterial.FromPart(part));
|
||||
|
||||
Assert.True(support.IsSupported);
|
||||
Assert.False(support.IsHeldByTab);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PlanCutting_TabsAShortPartNoTabCanSteady_WithoutTheLimit_AndDoesNotWarn()
|
||||
public void PlanCutting_TabsAPartWithoutAWarning()
|
||||
{
|
||||
var (_, plate, _) = Square(Parameters(0));
|
||||
var (_, plate, _) = Square(Parameters());
|
||||
|
||||
var result = CuttingPlanService.Plan(CuttingPlanRequest.ForPlate(plate, Vector.Zero,
|
||||
confirmedParameters: Parameters(0)));
|
||||
|
||||
// Tabbed, a part counts as steady wherever its tab is.
|
||||
Assert.True(result.Status == CuttingPlanStatus.Ready, string.Join("\n", result.Findings.Select(f => f.Message)));
|
||||
Assert.Empty(result.Findings);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PlanCutting_TabsAShortPartWithoutAWarning()
|
||||
{
|
||||
var (_, plate, _) = Square(Parameters(2));
|
||||
|
||||
var result = CuttingPlanService.Plan(CuttingPlanRequest.ForPlate(plate, Vector.Zero,
|
||||
confirmedParameters: Parameters(2)));
|
||||
confirmedParameters: Parameters()));
|
||||
|
||||
Assert.True(result.Status == CuttingPlanStatus.Ready, string.Join("\n", result.Findings.Select(f => f.Message)));
|
||||
Assert.Equal(TabSize, TabGap(Assert.Single(result.ProposedOrder)), 6);
|
||||
@@ -158,12 +141,12 @@ public class TabHeldSupportTabTests
|
||||
disc.MoveTo(2, 1);
|
||||
disc.ArcTo(2, 1, 1, 1, RotationType.CCW);
|
||||
var nest = new Nest("round");
|
||||
var plate = new Plate(20, 20) { CuttingParameters = Parameters(2) };
|
||||
var plate = new Plate(20, 20) { CuttingParameters = Parameters() };
|
||||
nest.Plates.Add(plate);
|
||||
nest.SetSupportBed(Bed);
|
||||
plate.Parts.Add(new Part(new Drawing("disc", disc), new Vector(3, 3)));
|
||||
|
||||
var proposal = CuttingPlanBatch.Capture([plate], Parameters(2), preservePartOrder: false).Plan();
|
||||
var proposal = CuttingPlanBatch.Capture([plate], Parameters(), preservePartOrder: false).Plan();
|
||||
|
||||
Assert.True(proposal.CanApply, string.Join("\n", proposal.Describe("in")));
|
||||
Assert.Equal(TabSize, TabGap(Assert.Single(proposal.Plates[0].Result.ProposedOrder)), 6);
|
||||
@@ -173,19 +156,19 @@ public class TabHeldSupportTabTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PrePost_WarnsOnlyAboutAnUntabbedShortPart()
|
||||
public void PrePost_WarnsOnlyAboutAnUntabbedPart()
|
||||
{
|
||||
var lead = new Line(new Vector(0, 0), new Vector(0, 1.5));
|
||||
var (untabbed, _, bare) = Square(Parameters(2));
|
||||
bare.ApplySingleLeadIn(Parameters(2), new Vector(0, 0.75), lead, ContourType.External);
|
||||
var (tabbed, _, held) = Square(Parameters(2));
|
||||
var withTabs = Parameters(2);
|
||||
var (untabbed, _, bare) = Square(Parameters());
|
||||
bare.ApplySingleLeadIn(Parameters(), new Vector(0, 0.75), lead, ContourType.External);
|
||||
var (tabbed, _, held) = Square(Parameters());
|
||||
var withTabs = Parameters();
|
||||
withTabs.TabsEnabled = true;
|
||||
held.ApplySingleLeadIn(withTabs, new Vector(0, 0.75), lead, ContourType.External);
|
||||
|
||||
var finding = Assert.Single(PostVerificationAnalyzer.Analyze(untabbed).Findings,
|
||||
f => f.Kind == PostVerificationKind.PartSupport);
|
||||
Assert.Contains("short enough for its tab alone to hold", finding.Message);
|
||||
Assert.Contains("support contact", finding.Message);
|
||||
Assert.Contains("no tab", finding.Message);
|
||||
Assert.DoesNotContain(PostVerificationAnalyzer.Analyze(tabbed).Findings,
|
||||
f => f.Kind == PostVerificationKind.PartSupport);
|
||||
|
||||
@@ -12,10 +12,16 @@ namespace OpenNest.Controls
|
||||
// Every field label shares this column so inputs line up across sections.
|
||||
private const int FieldIndent = 16;
|
||||
private const int InputWidth = 100;
|
||||
// The leads column's width when the panel lays out side by side.
|
||||
private const int LeadsColumnWidth = 360;
|
||||
|
||||
private static readonly Color HintColor = SystemColors.GrayText;
|
||||
|
||||
// The whole panel: the source line above one column, or above the leads and option
|
||||
// columns side by side.
|
||||
private readonly TableLayoutPanel layout;
|
||||
// The column sections are being added to while the panel is built.
|
||||
private TableLayoutPanel column;
|
||||
private readonly ToolTip toolTip = new ToolTip { AutoPopDelay = 15000 };
|
||||
|
||||
private readonly TabControl tabControl;
|
||||
@@ -27,10 +33,8 @@ namespace OpenNest.Controls
|
||||
private readonly NumericUpDown nudTabWidth;
|
||||
private readonly RadioButton rbSupportTab;
|
||||
private readonly RadioButton rbTabBySize;
|
||||
private readonly TableLayoutPanel supportTabOptions;
|
||||
private readonly NumericUpDown nudTabSizeMin;
|
||||
private readonly NumericUpDown nudTabSizeMax;
|
||||
private readonly NumericUpDown nudTabHeldMax;
|
||||
private readonly CheckBox chkSliceSlugs;
|
||||
private readonly ComboBox cboLabelMode;
|
||||
private readonly NumericUpDown nudPierceClearance;
|
||||
@@ -84,7 +88,11 @@ namespace OpenNest.Controls
|
||||
/// False leaves out the lead-in and lead-out editors (Machine Configuration edits a
|
||||
/// thickness's leads on their own tabs); lead-in angle rounding stays.
|
||||
/// </param>
|
||||
public CuttingPanel(bool showLeads)
|
||||
/// <param name="sideBySide">
|
||||
/// True puts the leads in a column of their own beside the other settings, for a dialog;
|
||||
/// false stacks everything in one column, for a narrow side panel.
|
||||
/// </param>
|
||||
public CuttingPanel(bool showLeads, bool sideBySide = false)
|
||||
{
|
||||
AutoScroll = true;
|
||||
BackColor = Color.White;
|
||||
@@ -94,10 +102,23 @@ namespace OpenNest.Controls
|
||||
Dock = DockStyle.Top,
|
||||
AutoSize = true,
|
||||
AutoSizeMode = AutoSizeMode.GrowAndShrink,
|
||||
ColumnCount = 1,
|
||||
ColumnCount = sideBySide ? 2 : 1,
|
||||
Padding = new Padding(10, 2, 10, 10),
|
||||
};
|
||||
layout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100));
|
||||
var leadsColumn = layout;
|
||||
var optionsColumn = layout;
|
||||
if (sideBySide)
|
||||
{
|
||||
layout.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, LeadsColumnWidth));
|
||||
layout.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
|
||||
leadsColumn = CreateColumn(new Padding(0));
|
||||
optionsColumn = CreateColumn(new Padding(20, 0, 0, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
layout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100));
|
||||
}
|
||||
column = layout;
|
||||
|
||||
// Where these settings are saved: the nest's machine thickness, or this PC.
|
||||
sourceLabel = new Label
|
||||
@@ -108,8 +129,15 @@ namespace OpenNest.Controls
|
||||
Visible = false,
|
||||
};
|
||||
layout.Controls.Add(sourceLabel);
|
||||
if (sideBySide)
|
||||
{
|
||||
layout.SetColumnSpan(sourceLabel, 2);
|
||||
layout.Controls.Add(leadsColumn, 0, 1);
|
||||
layout.Controls.Add(optionsColumn, 1, 1);
|
||||
}
|
||||
|
||||
// Leads: one tab per contour type, sized for the type with the most fields.
|
||||
column = leadsColumn;
|
||||
if (showLeads)
|
||||
AddSection("Leads");
|
||||
|
||||
@@ -134,7 +162,7 @@ namespace OpenNest.Controls
|
||||
tabControl.Controls.Add(tabExternal);
|
||||
tabControl.Controls.Add(tabInternal);
|
||||
if (showLeads)
|
||||
layout.Controls.Add(tabControl);
|
||||
column.Controls.Add(tabControl);
|
||||
|
||||
chkRoundLeadInAngles = new CheckBox
|
||||
{
|
||||
@@ -150,7 +178,7 @@ namespace OpenNest.Controls
|
||||
nudLeadInAngleIncrement.Width = 56;
|
||||
nudLeadInAngleIncrement.Enabled = false;
|
||||
toolTip.SetToolTip(chkRoundLeadInAngles, "Snaps each lead-in's angle to a multiple of this many degrees.");
|
||||
layout.Controls.Add(CreateInline(chkRoundLeadInAngles, nudLeadInAngleIncrement, CreateHint("°")));
|
||||
column.Controls.Add(CreateInline(chkRoundLeadInAngles, nudLeadInAngleIncrement, CreateHint("°")));
|
||||
|
||||
chkRoundLeadInAngles.CheckedChanged += (s, e) =>
|
||||
{
|
||||
@@ -160,6 +188,7 @@ namespace OpenNest.Controls
|
||||
nudLeadInAngleIncrement.ValueChanged += (s, e) => OnParametersChanged();
|
||||
|
||||
// Tabs
|
||||
column = optionsColumn;
|
||||
AddSection("Tabs");
|
||||
|
||||
chkTabsEnabled = new CheckBox
|
||||
@@ -168,7 +197,9 @@ namespace OpenNest.Controls
|
||||
AutoSize = true,
|
||||
Margin = new Padding(0, 3, 0, 3),
|
||||
};
|
||||
layout.Controls.Add(chkTabsEnabled);
|
||||
toolTip.SetToolTip(chkTabsEnabled,
|
||||
"Plan Cutting tabs the parts chosen below; a tabbed part stays in the sheet on its tab.");
|
||||
column.Controls.Add(chkTabsEnabled);
|
||||
|
||||
tabOptions = ControlFactory.SettingsGrid(FieldIndent);
|
||||
tabOptions.Enabled = false;
|
||||
@@ -179,42 +210,22 @@ namespace OpenNest.Controls
|
||||
// Plan Cutting tabs only the parts the plate's support grid cannot hold level.
|
||||
rbSupportTab = new RadioButton
|
||||
{
|
||||
Text = "Only tab parts the support grid can't hold level",
|
||||
Text = "Tab parts the support grid can't hold level",
|
||||
AutoSize = true,
|
||||
Checked = true,
|
||||
Margin = new Padding(0, 4, 0, 0),
|
||||
};
|
||||
toolTip.SetToolTip(rbSupportTab,
|
||||
"Plan Cutting tabs each part that would tip once cut free, where it best keeps the part level.");
|
||||
"Plan Cutting tabs each part that would tip once cut free, and its tab holds it wherever the tab goes. "
|
||||
+ "A plate with no support bed tabs by the size range instead.");
|
||||
AddSpanningRow(tabOptions, rbSupportTab);
|
||||
|
||||
// A part up to this long is held by its tab alone, wherever the tab goes. 0 turns it off.
|
||||
supportTabOptions = new TableLayoutPanel
|
||||
{
|
||||
AutoSize = true,
|
||||
AutoSizeMode = AutoSizeMode.GrowAndShrink,
|
||||
ColumnCount = 1,
|
||||
Margin = new Padding(FieldIndent + 2, 0, 0, 0),
|
||||
};
|
||||
nudTabHeldMax = CreateNumeric(0, 0.25);
|
||||
nudTabHeldMax.Width = 80;
|
||||
toolTip.SetToolTip(nudTabHeldMax,
|
||||
"Parts this short stay in the sheet on their tab, so a tab anywhere holds them without the grid.");
|
||||
supportTabOptions.Controls.Add(
|
||||
CreateInline(
|
||||
CreateHint("Tab alone holds parts up to", new Padding(0, 0, 4, 0)),
|
||||
nudTabHeldMax,
|
||||
CreateHint("long (0 = off)", new Padding(6, 0, 0, 0))
|
||||
)
|
||||
);
|
||||
AddSpanningRow(tabOptions, supportTabOptions);
|
||||
|
||||
// Tabs the parts whose narrow side is in the range below, whatever the support grid.
|
||||
rbTabBySize = new RadioButton
|
||||
{
|
||||
Text = "Tab parts by size",
|
||||
AutoSize = true,
|
||||
Margin = new Padding(0, 2, 0, 0),
|
||||
Margin = new Padding(0, 2, 0, 2),
|
||||
};
|
||||
toolTip.SetToolTip(rbTabBySize,
|
||||
"Ignores the support grid: tabs every part whose narrow side is in the range below.");
|
||||
@@ -223,51 +234,36 @@ namespace OpenNest.Controls
|
||||
// The size range: the narrow side of each part's smallest bounding box, at any angle.
|
||||
// Tabs by size use it, and so do support grid tabs on a plate with no support bed. A
|
||||
// maximum of 0 tabs nothing.
|
||||
var sizeRange = new TableLayoutPanel
|
||||
{
|
||||
AutoSize = true,
|
||||
AutoSizeMode = AutoSizeMode.GrowAndShrink,
|
||||
ColumnCount = 1,
|
||||
Margin = new Padding(FieldIndent + 2, 0, 0, 0),
|
||||
};
|
||||
sizeRange.Controls.Add(
|
||||
CreateHint("By size, or with no support bed, tab parts whose narrow side is:", new Padding(0, 4, 0, 2))
|
||||
);
|
||||
nudTabSizeMin = CreateNumeric(0, 0.25);
|
||||
nudTabSizeMin.Width = 80;
|
||||
nudTabSizeMax = CreateNumeric(0, 0.25);
|
||||
nudTabSizeMax.Width = 80;
|
||||
nudTabSizeMax.Maximum = (decimal)SupportTabSettings.TabEveryPartMaxWidth;
|
||||
toolTip.SetToolTip(nudTabSizeMax,
|
||||
"The narrow side of the part's smallest bounding box, at any angle, so a part's rotation does not matter.");
|
||||
sizeRange.Controls.Add(
|
||||
CreateInline(
|
||||
nudTabSizeMin,
|
||||
CreateHint("to", new Padding(4, 0, 4, 0)),
|
||||
nudTabSizeMax,
|
||||
CreateHint("(0 = none)", new Padding(6, 0, 0, 0))
|
||||
)
|
||||
const string sizeRangeTip =
|
||||
"By size, or on a plate with no support bed, parts whose narrow side is in this range are tabbed. "
|
||||
+ "The narrow side of the part's smallest bounding box, at any angle, so its rotation does not matter. "
|
||||
+ "A maximum of 0 tabs none.";
|
||||
toolTip.SetToolTip(nudTabSizeMin, sizeRangeTip);
|
||||
toolTip.SetToolTip(nudTabSizeMax, sizeRangeTip);
|
||||
var sizeRange = CreateInline(
|
||||
nudTabSizeMin,
|
||||
CreateHint("to", new Padding(4, 0, 4, 0)),
|
||||
nudTabSizeMax
|
||||
);
|
||||
AddSpanningRow(tabOptions, sizeRange);
|
||||
layout.Controls.Add(tabOptions);
|
||||
AddRow(tabOptions, "Narrow side from:", sizeRange, FieldIndent);
|
||||
column.Controls.Add(tabOptions);
|
||||
|
||||
chkTabsEnabled.CheckedChanged += (s, e) =>
|
||||
{
|
||||
tabOptions.Enabled = chkTabsEnabled.Checked;
|
||||
UpdateSupportTabOptions();
|
||||
OnParametersChanged();
|
||||
};
|
||||
|
||||
// The two choices toggle together, so one handler sees every change.
|
||||
rbSupportTab.CheckedChanged += (s, e) =>
|
||||
{
|
||||
UpdateSupportTabOptions();
|
||||
OnParametersChanged();
|
||||
};
|
||||
rbSupportTab.CheckedChanged += (s, e) => OnParametersChanged();
|
||||
nudTabWidth.ValueChanged += (s, e) => OnParametersChanged();
|
||||
nudTabSizeMin.ValueChanged += (s, e) => OnParametersChanged();
|
||||
nudTabSizeMax.ValueChanged += (s, e) => OnParametersChanged();
|
||||
nudTabHeldMax.ValueChanged += (s, e) => OnParametersChanged();
|
||||
|
||||
// Cutouts: slugs that would tip are cut in pieces that drop between the supports.
|
||||
AddSection("Cutouts");
|
||||
@@ -281,7 +277,7 @@ namespace OpenNest.Controls
|
||||
toolTip.SetToolTip(chkSliceSlugs,
|
||||
"Plan Cutting first cuts each cutout slug that would tip along the support grid's lines, "
|
||||
+ "stopping a kerf short of the cutout, so its pieces drop between the supports.");
|
||||
layout.Controls.Add(chkSliceSlugs);
|
||||
column.Controls.Add(chkSliceSlugs);
|
||||
chkSliceSlugs.CheckedChanged += (s, e) => OnParametersChanged();
|
||||
|
||||
// Marks: the part number and bend groups etched in each drawing's label box.
|
||||
@@ -301,7 +297,7 @@ namespace OpenNest.Controls
|
||||
"Plan Cutting etches each part's number in the label box set in the CAD Converter, "
|
||||
+ "alone or with its bend groups (A across the grain, B with it, then C and on). "
|
||||
+ "Parts with no label box get none.");
|
||||
layout.Controls.Add(marksGrid);
|
||||
column.Controls.Add(marksGrid);
|
||||
cboLabelMode.SelectedIndexChanged += (s, e) => OnParametersChanged();
|
||||
|
||||
// Pierce
|
||||
@@ -317,7 +313,7 @@ namespace OpenNest.Controls
|
||||
AddRow(pierceGrid, "Pierce zone diameter:", nudPierceDiameter, 0, "0 = off");
|
||||
toolTip.SetToolTip(nudPierceDiameter,
|
||||
"Diameter of the crater a pierce blows through the plate. Each pierce keeps half of it from all part material.");
|
||||
layout.Controls.Add(pierceGrid);
|
||||
column.Controls.Add(pierceGrid);
|
||||
|
||||
nudPierceClearance.ValueChanged += (s, e) => OnParametersChanged();
|
||||
nudPierceDiameter.ValueChanged += (s, e) => OnParametersChanged();
|
||||
@@ -392,7 +388,6 @@ namespace OpenNest.Controls
|
||||
parameters.TabBySize = rbTabBySize.Checked;
|
||||
parameters.TabSizeMinWidth = (double)nudTabSizeMin.Value;
|
||||
parameters.TabSizeMaxWidth = (double)nudTabSizeMax.Value;
|
||||
parameters.TabHeldMaxLength = (double)nudTabHeldMax.Value;
|
||||
parameters.SliceTippingSlugs = chkSliceSlugs.Checked;
|
||||
parameters.LabelMode = (PartLabelMode)System.Math.Max(0, cboLabelMode.SelectedIndex);
|
||||
return parameters;
|
||||
@@ -418,9 +413,7 @@ namespace OpenNest.Controls
|
||||
nudTabWidth.Value = Clamp(nudTabWidth, p.TabConfig.Size);
|
||||
nudTabSizeMin.Value = Clamp(nudTabSizeMin, p.TabSizeMinWidth);
|
||||
nudTabSizeMax.Value = Clamp(nudTabSizeMax, p.TabSizeMaxWidth);
|
||||
nudTabHeldMax.Value = Clamp(nudTabHeldMax, p.TabHeldMaxLength);
|
||||
tabOptions.Enabled = chkTabsEnabled.Checked;
|
||||
UpdateSupportTabOptions();
|
||||
chkSliceSlugs.Checked = p.SliceTippingSlugs;
|
||||
// A mode the list does not offer (set in code; files load it as Off) shows as Off.
|
||||
cboLabelMode.SelectedIndex = System.Enum.IsDefined(p.LabelMode) ? (int)p.LabelMode : (int)PartLabelMode.Off;
|
||||
@@ -441,11 +434,6 @@ namespace OpenNest.Controls
|
||||
internalLeads.PreviewParameters = parameters;
|
||||
}
|
||||
|
||||
private void UpdateSupportTabOptions()
|
||||
{
|
||||
supportTabOptions.Enabled = chkTabsEnabled.Checked && rbSupportTab.Checked;
|
||||
}
|
||||
|
||||
private static decimal Clamp(NumericUpDown control, double value) =>
|
||||
double.IsFinite(value)
|
||||
? System.Math.Clamp((decimal)value, control.Minimum, control.Maximum)
|
||||
@@ -469,12 +457,27 @@ namespace OpenNest.Controls
|
||||
Anchor = AnchorStyles.Left | AnchorStyles.Right,
|
||||
TextAlign = ContentAlignment.BottomLeft,
|
||||
Font = new Font(Font, FontStyle.Bold),
|
||||
Margin = new Padding(0, layout.Controls.Count == 0 ? 4 : 12, 0, 4),
|
||||
Margin = new Padding(0, column.Controls.Count == (column == layout ? 1 : 0) ? 4 : 12, 0, 4),
|
||||
Padding = new Padding(0, 0, 0, 3),
|
||||
};
|
||||
header.Paint += (s, e) =>
|
||||
e.Graphics.DrawLine(SystemPens.ControlLight, 0, header.Height - 1, header.Width, header.Height - 1);
|
||||
layout.Controls.Add(header);
|
||||
column.Controls.Add(header);
|
||||
}
|
||||
|
||||
// One column of sections, in a cell of the side-by-side layout.
|
||||
private static TableLayoutPanel CreateColumn(Padding margin)
|
||||
{
|
||||
var result = new TableLayoutPanel
|
||||
{
|
||||
AutoSize = true,
|
||||
AutoSizeMode = AutoSizeMode.GrowAndShrink,
|
||||
ColumnCount = 1,
|
||||
Dock = DockStyle.Fill,
|
||||
Margin = margin,
|
||||
};
|
||||
result.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100));
|
||||
return result;
|
||||
}
|
||||
|
||||
private static void AddRow(
|
||||
|
||||
@@ -18,7 +18,8 @@ namespace OpenNest.Forms
|
||||
ShowInTaskbar = false;
|
||||
StartPosition = FormStartPosition.CenterParent;
|
||||
|
||||
cuttingPanel = new CuttingPanel { Dock = DockStyle.Fill };
|
||||
// The leads beside the other settings, so the dialog stays short.
|
||||
cuttingPanel = new CuttingPanel(showLeads: true, sideBySide: true) { Dock = DockStyle.Fill };
|
||||
|
||||
var btnOk = new Button
|
||||
{
|
||||
|
||||
@@ -40,9 +40,8 @@ var result = CuttingPlanService.Plan(snapshot, cancellationToken);
|
||||
tabbed perimeter whose automatic entries are ranked by the route, clear of inside corners,
|
||||
not by how well the tab steadies it. A tabbed
|
||||
part counts as steady wherever its tab is: it is never warned about and stays crossable once
|
||||
cut, though the plan [goes around it where it can](#tabbed-parts-are-avoided-first). A tab in an inside corner is noted on the plan without changing its status. A part no
|
||||
longer than `TabHeldMaxLength` is held by its tab
|
||||
alone, so any tab clear of inside corners steadies it. Without a bed, or with
|
||||
cut, though the plan [goes around it where it can](#tabbed-parts-are-avoided-first). A tab in an inside corner is noted on the plan without changing its status. Every such
|
||||
part is held by its tab, so any tab clear of inside corners steadies it. Without a bed, or with
|
||||
`CuttingParameters.TabBySize`, the parts whose width is in `TabSizeMinWidth`..`TabSizeMaxWidth`
|
||||
are tabbed instead, and with no range set the plan notes that nothing was tabbed; see
|
||||
[support tabs](support-tabs.md).
|
||||
|
||||
+17
-18
@@ -128,24 +128,23 @@ once cut, while a detour to the steadiest point lengthens the way for every part
|
||||
steadiest instead, a long strip resting on one line of contacts started mid-length, or on its
|
||||
side away from the next cut, so the head left it back over the strip. Lead checks are unchanged.
|
||||
|
||||
## Parts the tab alone holds
|
||||
## Tabbed parts are held by their tab
|
||||
|
||||
A tabbed part stays in the sheet on its tab, and a part short enough does not need the bed at
|
||||
all: the tab holds it wherever it goes. Cutting Parameters > Tabs > "Tab alone holds parts up to"
|
||||
sets `CuttingParameters.TabHeldMaxLength`: on a plate with a support bed, a part the bed cannot
|
||||
hold level whose length (the long side of its outline's minimum-area bounding rectangle,
|
||||
`SupportAnalyzer.Length`) is at most that, bound included, is still tabbed, but
|
||||
A tabbed part stays in the sheet on its tab, however long it is. On a plate with a support bed,
|
||||
`SupportTabSettings.Analyze` tabs every part the bed cannot hold level and
|
||||
`SupportAnalyzer.HeldByTab` marks its analysis `IsHeldByTab`: it keeps its contacts and margin,
|
||||
every tab clear of inside corners steadies it, and its best tab point is chosen as for a part
|
||||
tabbed by size (below). A part the bed holds is not tabbed. 0 turns the rule off; new settings
|
||||
start at 6, while settings saved without the field read as 0, so saved settings keep their
|
||||
meaning. Some outlines have two minimum-area rectangles (a right isosceles triangle fits both
|
||||
its legs' square and its hypotenuse's 2:1 box), and which one rounding finds depends on how the
|
||||
part is turned; of rectangles tied for area, `SupportAnalyzer` measures the one with the shorter
|
||||
long side, so a drawing's length and width are the same at every rotation.
|
||||
`SupportTabSettings.Analyze` applies it for Plan Cutting, hand-placed lead-ins and the pre-post
|
||||
review alike, so such a part warns only when it is cut with no tab at all. View > Draw Support
|
||||
does not read cutting settings and still shows it red, since it would tip without its tab.
|
||||
tabbed by size (below). A part the bed holds is not tabbed. The former length limit ("Tab alone
|
||||
holds parts up to", `TabHeldMaxLength`) is gone; settings and nests saved with it read
|
||||
unchanged and ignore it. `SupportTabSettings.Analyze` applies this for Plan Cutting,
|
||||
hand-placed lead-ins and the pre-post review alike, so such a part warns only when it is cut
|
||||
with no tab at all. View > Draw Support does not read cutting settings and still shows it red,
|
||||
since it would tip without its tab.
|
||||
|
||||
Some outlines have two minimum-area rectangles (a right isosceles triangle fits both its legs'
|
||||
square and its hypotenuse's 2:1 box), and which one rounding finds depends on how the part is
|
||||
turned; of rectangles tied for area, `SupportAnalyzer` measures the one with the shorter long
|
||||
side, so a drawing's width is the same at every rotation.
|
||||
|
||||
## Tabbing by size
|
||||
|
||||
@@ -178,9 +177,9 @@ settings and the cutting panel): a plate's recorded parameters and drawing pins
|
||||
`TabsEnabled` and replay as planned.
|
||||
|
||||
If none of those entries has a lead-in that fits, the part is still tabbed. The search falls
|
||||
back to every entry (`SupportEntries.Any`), ordered by how well the tab steadies the part; of
|
||||
the entries whose lead-in fits, it keeps every one that holds the part level, or else only the
|
||||
steadiest. The open-scrap pierce fallback then tries that catalog.
|
||||
back to every entry (`SupportEntries.Any`), inside corners included; since every tab holds a
|
||||
tabbed part, the route decides among those whose lead-in fits. The open-scrap pierce fallback
|
||||
then tries that catalog.
|
||||
|
||||
A tabbed part counts as steady wherever its tab is: where its tab lands is never a warning. No message says a tab cannot steady its part, and once cut a tabbed part stays
|
||||
crossable, as its retained material allows, whether or not its tab holds it level. Plan Cutting
|
||||
|
||||
Reference in new issue
Block a user