fix(cutting): restrict tabs to external perimeter and clarify tab UI
Tabs were being applied to internal cutouts and circle holes, which is
incorrect — only the external perimeter should be tabbed. Restructured
the Tabs panel to use radio buttons ("Tab all parts" vs "Auto-tab by
smallest dimension") so the two modes are clearly mutually exclusive
instead of the confusing implicit override behavior.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -305,9 +305,6 @@ namespace OpenNest.CNC.CuttingStrategy
|
|||||||
subPgm.Codes.AddRange(leadIn.Generate(relativePoint, normal, winding));
|
subPgm.Codes.AddRange(leadIn.Generate(relativePoint, normal, winding));
|
||||||
var reindexed = relativeShape.ReindexAt(relativePoint, relativeCircle);
|
var reindexed = relativeShape.ReindexAt(relativePoint, relativeCircle);
|
||||||
|
|
||||||
if (Parameters.TabsEnabled && Parameters.TabConfig != null)
|
|
||||||
reindexed = TrimShapeForTab(reindexed, relativePoint, Parameters.TabConfig.Size);
|
|
||||||
|
|
||||||
subPgm.Codes.AddRange(ConvertShapeToMoves(reindexed, relativePoint));
|
subPgm.Codes.AddRange(ConvertShapeToMoves(reindexed, relativePoint));
|
||||||
subPgm.Codes.AddRange(leadOut.Generate(relativePoint, normal, winding));
|
subPgm.Codes.AddRange(leadOut.Generate(relativePoint, normal, winding));
|
||||||
subPgm.Mode = Mode.Incremental;
|
subPgm.Mode = Mode.Incremental;
|
||||||
@@ -331,7 +328,7 @@ namespace OpenNest.CNC.CuttingStrategy
|
|||||||
|
|
||||||
var reindexedShape = shape.ReindexAt(point, entity);
|
var reindexedShape = shape.ReindexAt(point, entity);
|
||||||
|
|
||||||
if (Parameters.TabsEnabled && Parameters.TabConfig != null)
|
if (Parameters.TabsEnabled && Parameters.TabConfig != null && contourType == ContourType.External)
|
||||||
reindexedShape = TrimShapeForTab(reindexedShape, point, Parameters.TabConfig.Size);
|
reindexedShape = TrimShapeForTab(reindexedShape, point, Parameters.TabConfig.Size);
|
||||||
|
|
||||||
program.Codes.AddRange(ConvertShapeToMoves(reindexedShape, point));
|
program.Codes.AddRange(ConvertShapeToMoves(reindexedShape, point));
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ namespace OpenNest.Controls
|
|||||||
|
|
||||||
private readonly CheckBox chkTabsEnabled;
|
private readonly CheckBox chkTabsEnabled;
|
||||||
private readonly NumericUpDown nudTabWidth;
|
private readonly NumericUpDown nudTabWidth;
|
||||||
|
private readonly RadioButton rbTabAll;
|
||||||
|
private readonly RadioButton rbAutoTab;
|
||||||
private readonly NumericUpDown nudAutoTabMin;
|
private readonly NumericUpDown nudAutoTabMin;
|
||||||
private readonly NumericUpDown nudAutoTabMax;
|
private readonly NumericUpDown nudAutoTabMax;
|
||||||
private readonly NumericUpDown nudPierceClearance;
|
private readonly NumericUpDown nudPierceClearance;
|
||||||
@@ -112,7 +114,7 @@ namespace OpenNest.Controls
|
|||||||
{
|
{
|
||||||
HeaderText = "Tabs",
|
HeaderText = "Tabs",
|
||||||
Dock = DockStyle.Top,
|
Dock = DockStyle.Top,
|
||||||
ExpandedHeight = 120,
|
ExpandedHeight = 160,
|
||||||
IsExpanded = false
|
IsExpanded = false
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -122,44 +124,78 @@ namespace OpenNest.Controls
|
|||||||
Location = new Point(12, 4),
|
Location = new Point(12, 4),
|
||||||
AutoSize = true
|
AutoSize = true
|
||||||
};
|
};
|
||||||
chkTabsEnabled.CheckedChanged += (s, e) =>
|
|
||||||
{
|
|
||||||
nudTabWidth.Enabled = chkTabsEnabled.Checked;
|
|
||||||
OnParametersChanged();
|
|
||||||
};
|
|
||||||
tabsPanel.ContentPanel.Controls.Add(chkTabsEnabled);
|
tabsPanel.ContentPanel.Controls.Add(chkTabsEnabled);
|
||||||
|
|
||||||
tabsPanel.ContentPanel.Controls.Add(new Label
|
tabsPanel.ContentPanel.Controls.Add(new Label
|
||||||
{
|
{
|
||||||
Text = "Width:",
|
Text = "Tab Size:",
|
||||||
Location = new Point(160, 6),
|
Location = new Point(160, 6),
|
||||||
AutoSize = true
|
AutoSize = true
|
||||||
});
|
});
|
||||||
|
|
||||||
nudTabWidth = CreateNumeric(215, 3, 0.25, 0.0625);
|
nudTabWidth = CreateNumeric(225, 3, 0.25, 0.0625);
|
||||||
nudTabWidth.Enabled = false;
|
nudTabWidth.Enabled = false;
|
||||||
tabsPanel.ContentPanel.Controls.Add(nudTabWidth);
|
tabsPanel.ContentPanel.Controls.Add(nudTabWidth);
|
||||||
|
|
||||||
|
rbTabAll = new RadioButton
|
||||||
|
{
|
||||||
|
Text = "Tab all parts",
|
||||||
|
Location = new Point(28, 28),
|
||||||
|
AutoSize = true,
|
||||||
|
Enabled = false,
|
||||||
|
Checked = true
|
||||||
|
};
|
||||||
|
tabsPanel.ContentPanel.Controls.Add(rbTabAll);
|
||||||
|
|
||||||
|
rbAutoTab = new RadioButton
|
||||||
|
{
|
||||||
|
Text = "Auto-tab when smallest part dimension is between:",
|
||||||
|
Location = new Point(28, 50),
|
||||||
|
AutoSize = true,
|
||||||
|
Enabled = false
|
||||||
|
};
|
||||||
|
tabsPanel.ContentPanel.Controls.Add(rbAutoTab);
|
||||||
|
|
||||||
tabsPanel.ContentPanel.Controls.Add(new Label
|
tabsPanel.ContentPanel.Controls.Add(new Label
|
||||||
{
|
{
|
||||||
Text = "Auto-Tab Min Size:",
|
Text = "Min:",
|
||||||
Location = new Point(12, 32),
|
Location = new Point(44, 76),
|
||||||
AutoSize = true
|
AutoSize = true
|
||||||
});
|
});
|
||||||
|
|
||||||
nudAutoTabMin = CreateNumeric(140, 29, 0, 0.0625);
|
nudAutoTabMin = CreateNumeric(77, 73, 0, 0.0625);
|
||||||
|
nudAutoTabMin.Enabled = false;
|
||||||
tabsPanel.ContentPanel.Controls.Add(nudAutoTabMin);
|
tabsPanel.ContentPanel.Controls.Add(nudAutoTabMin);
|
||||||
|
|
||||||
tabsPanel.ContentPanel.Controls.Add(new Label
|
tabsPanel.ContentPanel.Controls.Add(new Label
|
||||||
{
|
{
|
||||||
Text = "Auto-Tab Max Size:",
|
Text = "Max:",
|
||||||
Location = new Point(12, 58),
|
Location = new Point(210, 76),
|
||||||
AutoSize = true
|
AutoSize = true
|
||||||
});
|
});
|
||||||
|
|
||||||
nudAutoTabMax = CreateNumeric(140, 55, 0, 0.0625);
|
nudAutoTabMax = CreateNumeric(245, 73, 0, 0.0625);
|
||||||
|
nudAutoTabMax.Enabled = false;
|
||||||
tabsPanel.ContentPanel.Controls.Add(nudAutoTabMax);
|
tabsPanel.ContentPanel.Controls.Add(nudAutoTabMax);
|
||||||
|
|
||||||
|
chkTabsEnabled.CheckedChanged += (s, e) =>
|
||||||
|
{
|
||||||
|
var enabled = chkTabsEnabled.Checked;
|
||||||
|
nudTabWidth.Enabled = enabled;
|
||||||
|
rbTabAll.Enabled = enabled;
|
||||||
|
rbAutoTab.Enabled = enabled;
|
||||||
|
nudAutoTabMin.Enabled = enabled && rbAutoTab.Checked;
|
||||||
|
nudAutoTabMax.Enabled = enabled && rbAutoTab.Checked;
|
||||||
|
OnParametersChanged();
|
||||||
|
};
|
||||||
|
|
||||||
|
rbTabAll.CheckedChanged += (s, e) =>
|
||||||
|
{
|
||||||
|
nudAutoTabMin.Enabled = chkTabsEnabled.Checked && rbAutoTab.Checked;
|
||||||
|
nudAutoTabMax.Enabled = chkTabsEnabled.Checked && rbAutoTab.Checked;
|
||||||
|
OnParametersChanged();
|
||||||
|
};
|
||||||
|
|
||||||
// Pierce section
|
// Pierce section
|
||||||
var piercePanel = new CollapsiblePanel
|
var piercePanel = new CollapsiblePanel
|
||||||
{
|
{
|
||||||
@@ -246,13 +282,13 @@ namespace OpenNest.Controls
|
|||||||
InternalLeadOut = BuildLeadOut(cboInternalLeadOut, pnlInternalLeadOut),
|
InternalLeadOut = BuildLeadOut(cboInternalLeadOut, pnlInternalLeadOut),
|
||||||
ArcCircleLeadIn = BuildLeadIn(cboArcCircleLeadIn, pnlArcCircleLeadIn),
|
ArcCircleLeadIn = BuildLeadIn(cboArcCircleLeadIn, pnlArcCircleLeadIn),
|
||||||
ArcCircleLeadOut = BuildLeadOut(cboArcCircleLeadOut, pnlArcCircleLeadOut),
|
ArcCircleLeadOut = BuildLeadOut(cboArcCircleLeadOut, pnlArcCircleLeadOut),
|
||||||
TabsEnabled = chkTabsEnabled.Checked,
|
TabsEnabled = chkTabsEnabled.Checked && rbTabAll.Checked,
|
||||||
TabConfig = new NormalTab { Size = (double)nudTabWidth.Value },
|
TabConfig = new NormalTab { Size = (double)nudTabWidth.Value },
|
||||||
PierceClearance = (double)nudPierceClearance.Value,
|
PierceClearance = (double)nudPierceClearance.Value,
|
||||||
RoundLeadInAngles = chkRoundLeadInAngles.Checked,
|
RoundLeadInAngles = chkRoundLeadInAngles.Checked,
|
||||||
LeadInAngleIncrement = (double)nudLeadInAngleIncrement.Value,
|
LeadInAngleIncrement = (double)nudLeadInAngleIncrement.Value,
|
||||||
AutoTabMinSize = (double)nudAutoTabMin.Value,
|
AutoTabMinSize = chkTabsEnabled.Checked && rbAutoTab.Checked ? (double)nudAutoTabMin.Value : 0,
|
||||||
AutoTabMaxSize = (double)nudAutoTabMax.Value
|
AutoTabMaxSize = chkTabsEnabled.Checked && rbAutoTab.Checked ? (double)nudAutoTabMax.Value : 0
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,7 +303,10 @@ namespace OpenNest.Controls
|
|||||||
LoadLeadIn(cboArcCircleLeadIn, pnlArcCircleLeadIn, p.ArcCircleLeadIn);
|
LoadLeadIn(cboArcCircleLeadIn, pnlArcCircleLeadIn, p.ArcCircleLeadIn);
|
||||||
LoadLeadOut(cboArcCircleLeadOut, pnlArcCircleLeadOut, p.ArcCircleLeadOut);
|
LoadLeadOut(cboArcCircleLeadOut, pnlArcCircleLeadOut, p.ArcCircleLeadOut);
|
||||||
|
|
||||||
chkTabsEnabled.Checked = p.TabsEnabled;
|
var hasAutoTab = p.AutoTabMinSize > 0 || p.AutoTabMaxSize > 0;
|
||||||
|
chkTabsEnabled.Checked = p.TabsEnabled || hasAutoTab;
|
||||||
|
rbAutoTab.Checked = hasAutoTab;
|
||||||
|
rbTabAll.Checked = !hasAutoTab;
|
||||||
if (p.TabConfig != null)
|
if (p.TabConfig != null)
|
||||||
nudTabWidth.Value = (decimal)p.TabConfig.Size;
|
nudTabWidth.Value = (decimal)p.TabConfig.Size;
|
||||||
nudPierceClearance.Value = (decimal)p.PierceClearance;
|
nudPierceClearance.Value = (decimal)p.PierceClearance;
|
||||||
|
|||||||
Reference in New Issue
Block a user