feat: add lead-out parameters and tab toggle to CuttingParametersForm
Restructure the cutting parameters dialog with separate Lead-In and Lead-Out GroupBoxes per tab, exposing editable length/angle/radius fields for lead-outs (previously hardcoded). Add Tabs section with enable checkbox and width control. Also fix lead-in/lead-out angle calculations and convert cutting strategy output to incremental mode. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -63,6 +63,10 @@ namespace OpenNest.CNC.CuttingStrategy
|
||||
result.Codes.AddRange(leadOut.Generate(perimeterPt, normal, winding));
|
||||
}
|
||||
|
||||
// Convert to incremental mode to match the convention used by
|
||||
// the rest of the system (rendering, bounding box, drag, etc.).
|
||||
result.Mode = Mode.Incremental;
|
||||
|
||||
return new CuttingResult
|
||||
{
|
||||
Program = result,
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace OpenNest.CNC.CuttingStrategy
|
||||
|
||||
public override Vector GetPiercePoint(Vector contourStartPoint, double contourNormalAngle)
|
||||
{
|
||||
var approachAngle = contourNormalAngle + Angle.ToRadians(ApproachAngle);
|
||||
var approachAngle = contourNormalAngle + Angle.HalfPI - Angle.ToRadians(ApproachAngle);
|
||||
return new Vector(
|
||||
contourStartPoint.X + Length * System.Math.Cos(approachAngle),
|
||||
contourStartPoint.Y + Length * System.Math.Sin(approachAngle));
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace OpenNest.CNC.CuttingStrategy
|
||||
{
|
||||
var piercePoint = GetPiercePoint(contourStartPoint, contourNormalAngle);
|
||||
|
||||
var secondAngle = contourNormalAngle + Angle.ToRadians(ApproachAngle1);
|
||||
var secondAngle = contourNormalAngle + Angle.HalfPI - Angle.ToRadians(ApproachAngle1);
|
||||
var midPoint = new Vector(
|
||||
contourStartPoint.X + Length2 * System.Math.Cos(secondAngle),
|
||||
contourStartPoint.Y + Length2 * System.Math.Sin(secondAngle));
|
||||
@@ -31,7 +31,7 @@ namespace OpenNest.CNC.CuttingStrategy
|
||||
|
||||
public override Vector GetPiercePoint(Vector contourStartPoint, double contourNormalAngle)
|
||||
{
|
||||
var secondAngle = contourNormalAngle + Angle.ToRadians(ApproachAngle1);
|
||||
var secondAngle = contourNormalAngle + Angle.HalfPI - Angle.ToRadians(ApproachAngle1);
|
||||
var midX = contourStartPoint.X + Length2 * System.Math.Cos(secondAngle);
|
||||
var midY = contourStartPoint.Y + Length2 * System.Math.Sin(secondAngle);
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace OpenNest.CNC.CuttingStrategy
|
||||
public override List<ICode> Generate(Vector contourEndPoint, double contourNormalAngle,
|
||||
RotationType winding = RotationType.CW)
|
||||
{
|
||||
var overcutAngle = contourNormalAngle + Angle.ToRadians(ApproachAngle);
|
||||
var overcutAngle = contourNormalAngle + Angle.HalfPI - Angle.ToRadians(ApproachAngle);
|
||||
var endPoint = new Vector(
|
||||
contourEndPoint.X + Length * System.Math.Cos(overcutAngle),
|
||||
contourEndPoint.Y + Length * System.Math.Sin(overcutAngle));
|
||||
|
||||
@@ -13,9 +13,9 @@ namespace OpenNest
|
||||
|
||||
public static readonly Layer Display = new Layer("DISPLAY") { Color = Color.Cyan };
|
||||
|
||||
public static readonly Layer Leadin = new Layer("LEADIN") { Color = Color.Yellow };
|
||||
public static readonly Layer Leadin = new Layer("LEADIN") { Color = Color.Brown };
|
||||
|
||||
public static readonly Layer Leadout = new Layer("LEADOUT") { Color = Color.Yellow };
|
||||
public static readonly Layer Leadout = new Layer("LEADOUT") { Color = Color.Brown };
|
||||
|
||||
public static readonly Layer Scribe = new Layer("SCRIBE") { Color = Color.Magenta };
|
||||
}
|
||||
|
||||
16
OpenNest/Forms/CuttingParametersForm.Designer.cs
generated
16
OpenNest/Forms/CuttingParametersForm.Designer.cs
generated
@@ -44,12 +44,12 @@ namespace OpenNest.Forms
|
||||
this.tabControl.Controls.Add(this.tabExternal);
|
||||
this.tabControl.Controls.Add(this.tabInternal);
|
||||
this.tabControl.Controls.Add(this.tabArcCircle);
|
||||
this.tabControl.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tabControl.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.tabControl.Location = new System.Drawing.Point(0, 0);
|
||||
this.tabControl.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.tabControl.Name = "tabControl";
|
||||
this.tabControl.SelectedIndex = 0;
|
||||
this.tabControl.Size = new System.Drawing.Size(368, 290);
|
||||
this.tabControl.Size = new System.Drawing.Size(380, 348);
|
||||
this.tabControl.TabIndex = 0;
|
||||
//
|
||||
// tabExternal
|
||||
@@ -58,7 +58,7 @@ namespace OpenNest.Forms
|
||||
this.tabExternal.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.tabExternal.Name = "tabExternal";
|
||||
this.tabExternal.Padding = new System.Windows.Forms.Padding(8);
|
||||
this.tabExternal.Size = new System.Drawing.Size(360, 261);
|
||||
this.tabExternal.Size = new System.Drawing.Size(372, 319);
|
||||
this.tabExternal.TabIndex = 0;
|
||||
this.tabExternal.Text = "External";
|
||||
this.tabExternal.UseVisualStyleBackColor = true;
|
||||
@@ -69,7 +69,7 @@ namespace OpenNest.Forms
|
||||
this.tabInternal.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.tabInternal.Name = "tabInternal";
|
||||
this.tabInternal.Padding = new System.Windows.Forms.Padding(8);
|
||||
this.tabInternal.Size = new System.Drawing.Size(360, 261);
|
||||
this.tabInternal.Size = new System.Drawing.Size(372, 319);
|
||||
this.tabInternal.TabIndex = 1;
|
||||
this.tabInternal.Text = "Internal";
|
||||
this.tabInternal.UseVisualStyleBackColor = true;
|
||||
@@ -80,7 +80,7 @@ namespace OpenNest.Forms
|
||||
this.tabArcCircle.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.tabArcCircle.Name = "tabArcCircle";
|
||||
this.tabArcCircle.Padding = new System.Windows.Forms.Padding(8);
|
||||
this.tabArcCircle.Size = new System.Drawing.Size(360, 261);
|
||||
this.tabArcCircle.Size = new System.Drawing.Size(372, 319);
|
||||
this.tabArcCircle.TabIndex = 2;
|
||||
this.tabArcCircle.Text = "Arc / Circle";
|
||||
this.tabArcCircle.UseVisualStyleBackColor = true;
|
||||
@@ -114,9 +114,9 @@ namespace OpenNest.Forms
|
||||
this.bottomPanel.Controls.Add(this.acceptButton);
|
||||
this.bottomPanel.Controls.Add(this.cancelButton);
|
||||
this.bottomPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
|
||||
this.bottomPanel.Location = new System.Drawing.Point(0, 290);
|
||||
this.bottomPanel.Location = new System.Drawing.Point(0, 406);
|
||||
this.bottomPanel.Name = "bottomPanel";
|
||||
this.bottomPanel.Size = new System.Drawing.Size(368, 50);
|
||||
this.bottomPanel.Size = new System.Drawing.Size(380, 50);
|
||||
this.bottomPanel.TabIndex = 1;
|
||||
//
|
||||
// CuttingParametersForm
|
||||
@@ -125,7 +125,7 @@ namespace OpenNest.Forms
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.cancelButton;
|
||||
this.ClientSize = new System.Drawing.Size(368, 340);
|
||||
this.ClientSize = new System.Drawing.Size(380, 456);
|
||||
this.Controls.Add(this.tabControl);
|
||||
this.Controls.Add(this.bottomPanel);
|
||||
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
|
||||
@@ -16,7 +16,12 @@ namespace OpenNest.Forms
|
||||
private ComboBox cboInternalLeadIn, cboInternalLeadOut;
|
||||
private ComboBox cboArcCircleLeadIn, cboArcCircleLeadOut;
|
||||
|
||||
private Panel pnlExternalParams, pnlInternalParams, pnlArcCircleParams;
|
||||
private Panel pnlExternalLeadIn, pnlExternalLeadOut;
|
||||
private Panel pnlInternalLeadIn, pnlInternalLeadOut;
|
||||
private Panel pnlArcCircleLeadIn, pnlArcCircleLeadOut;
|
||||
|
||||
private CheckBox chkTabsEnabled;
|
||||
private NumericUpDown nudTabWidth;
|
||||
|
||||
public CuttingParameters Parameters { get; set; } = new CuttingParameters();
|
||||
|
||||
@@ -24,15 +29,26 @@ namespace OpenNest.Forms
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
SetupTab(tabExternal, out cboExternalLeadIn, out cboExternalLeadOut, out pnlExternalParams);
|
||||
SetupTab(tabInternal, out cboInternalLeadIn, out cboInternalLeadOut, out pnlInternalParams);
|
||||
SetupTab(tabArcCircle, out cboArcCircleLeadIn, out cboArcCircleLeadOut, out pnlArcCircleParams);
|
||||
SetupTab(tabExternal,
|
||||
out cboExternalLeadIn, out pnlExternalLeadIn,
|
||||
out cboExternalLeadOut, out pnlExternalLeadOut);
|
||||
SetupTab(tabInternal,
|
||||
out cboInternalLeadIn, out pnlInternalLeadIn,
|
||||
out cboInternalLeadOut, out pnlInternalLeadOut);
|
||||
SetupTab(tabArcCircle,
|
||||
out cboArcCircleLeadIn, out pnlArcCircleLeadIn,
|
||||
out cboArcCircleLeadOut, out pnlArcCircleLeadOut);
|
||||
|
||||
SetupTabsSection();
|
||||
PopulateDropdowns();
|
||||
|
||||
cboExternalLeadIn.SelectedIndexChanged += OnLeadInTypeChanged;
|
||||
cboInternalLeadIn.SelectedIndexChanged += OnLeadInTypeChanged;
|
||||
cboArcCircleLeadIn.SelectedIndexChanged += OnLeadInTypeChanged;
|
||||
|
||||
cboExternalLeadOut.SelectedIndexChanged += OnLeadOutTypeChanged;
|
||||
cboInternalLeadOut.SelectedIndexChanged += OnLeadOutTypeChanged;
|
||||
cboArcCircleLeadOut.SelectedIndexChanged += OnLeadOutTypeChanged;
|
||||
}
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
@@ -41,54 +57,113 @@ namespace OpenNest.Forms
|
||||
LoadFromParameters(Parameters);
|
||||
}
|
||||
|
||||
private static void SetupTab(TabPage tab, out ComboBox leadInCombo,
|
||||
out ComboBox leadOutCombo, out Panel paramPanel)
|
||||
private static void SetupTab(TabPage tab,
|
||||
out ComboBox leadInCombo, out Panel leadInPanel,
|
||||
out ComboBox leadOutCombo, out Panel leadOutPanel)
|
||||
{
|
||||
var y = 12;
|
||||
|
||||
var lblLeadIn = new Label
|
||||
var grpLeadIn = new GroupBox
|
||||
{
|
||||
Text = "Lead-In:",
|
||||
Location = new System.Drawing.Point(8, y + 3),
|
||||
AutoSize = true
|
||||
Text = "Lead-In",
|
||||
Location = new System.Drawing.Point(4, 4),
|
||||
Size = new System.Drawing.Size(364, 168)
|
||||
};
|
||||
tab.Controls.Add(lblLeadIn);
|
||||
tab.Controls.Add(grpLeadIn);
|
||||
|
||||
grpLeadIn.Controls.Add(new Label
|
||||
{
|
||||
Text = "Type:",
|
||||
Location = new System.Drawing.Point(8, 22),
|
||||
AutoSize = true
|
||||
});
|
||||
|
||||
leadInCombo = new ComboBox
|
||||
{
|
||||
DropDownStyle = ComboBoxStyle.DropDownList,
|
||||
Location = new System.Drawing.Point(100, y),
|
||||
Size = new System.Drawing.Size(240, 24)
|
||||
Location = new System.Drawing.Point(90, 19),
|
||||
Size = new System.Drawing.Size(250, 24)
|
||||
};
|
||||
tab.Controls.Add(leadInCombo);
|
||||
grpLeadIn.Controls.Add(leadInCombo);
|
||||
|
||||
y += 32;
|
||||
|
||||
var lblLeadOut = new Label
|
||||
leadInPanel = new Panel
|
||||
{
|
||||
Text = "Lead-Out:",
|
||||
Location = new System.Drawing.Point(8, y + 3),
|
||||
AutoSize = true
|
||||
Location = new System.Drawing.Point(8, 48),
|
||||
Size = new System.Drawing.Size(340, 112),
|
||||
AutoScroll = true
|
||||
};
|
||||
tab.Controls.Add(lblLeadOut);
|
||||
grpLeadIn.Controls.Add(leadInPanel);
|
||||
|
||||
var grpLeadOut = new GroupBox
|
||||
{
|
||||
Text = "Lead-Out",
|
||||
Location = new System.Drawing.Point(4, 176),
|
||||
Size = new System.Drawing.Size(364, 132)
|
||||
};
|
||||
tab.Controls.Add(grpLeadOut);
|
||||
|
||||
grpLeadOut.Controls.Add(new Label
|
||||
{
|
||||
Text = "Type:",
|
||||
Location = new System.Drawing.Point(8, 22),
|
||||
AutoSize = true
|
||||
});
|
||||
|
||||
leadOutCombo = new ComboBox
|
||||
{
|
||||
DropDownStyle = ComboBoxStyle.DropDownList,
|
||||
Location = new System.Drawing.Point(100, y),
|
||||
Size = new System.Drawing.Size(240, 24)
|
||||
Location = new System.Drawing.Point(90, 19),
|
||||
Size = new System.Drawing.Size(250, 24)
|
||||
};
|
||||
tab.Controls.Add(leadOutCombo);
|
||||
grpLeadOut.Controls.Add(leadOutCombo);
|
||||
|
||||
y += 40;
|
||||
|
||||
paramPanel = new Panel
|
||||
leadOutPanel = new Panel
|
||||
{
|
||||
Location = new System.Drawing.Point(8, y),
|
||||
Size = new System.Drawing.Size(332, 170),
|
||||
Location = new System.Drawing.Point(8, 48),
|
||||
Size = new System.Drawing.Size(340, 76),
|
||||
AutoScroll = true
|
||||
};
|
||||
tab.Controls.Add(paramPanel);
|
||||
grpLeadOut.Controls.Add(leadOutPanel);
|
||||
}
|
||||
|
||||
private void SetupTabsSection()
|
||||
{
|
||||
var grpTabs = new GroupBox
|
||||
{
|
||||
Text = "Tabs",
|
||||
Location = new System.Drawing.Point(4, 350),
|
||||
Size = new System.Drawing.Size(372, 55),
|
||||
Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right
|
||||
};
|
||||
|
||||
chkTabsEnabled = new CheckBox
|
||||
{
|
||||
Text = "Enable Tabs",
|
||||
Location = new System.Drawing.Point(12, 22),
|
||||
AutoSize = true
|
||||
};
|
||||
chkTabsEnabled.CheckedChanged += (s, e) => nudTabWidth.Enabled = chkTabsEnabled.Checked;
|
||||
grpTabs.Controls.Add(chkTabsEnabled);
|
||||
|
||||
grpTabs.Controls.Add(new Label
|
||||
{
|
||||
Text = "Width:",
|
||||
Location = new System.Drawing.Point(160, 23),
|
||||
AutoSize = true
|
||||
});
|
||||
|
||||
nudTabWidth = new NumericUpDown
|
||||
{
|
||||
Location = new System.Drawing.Point(215, 20),
|
||||
Size = new System.Drawing.Size(100, 22),
|
||||
DecimalPlaces = 4,
|
||||
Increment = 0.0625m,
|
||||
Minimum = 0,
|
||||
Maximum = 9999,
|
||||
Value = 0.25m,
|
||||
Enabled = false
|
||||
};
|
||||
grpTabs.Controls.Add(nudTabWidth);
|
||||
|
||||
Controls.Add(grpTabs);
|
||||
}
|
||||
|
||||
private void PopulateDropdowns()
|
||||
@@ -109,20 +184,36 @@ namespace OpenNest.Forms
|
||||
private void OnLeadInTypeChanged(object sender, EventArgs e)
|
||||
{
|
||||
var combo = (ComboBox)sender;
|
||||
var panel = GetParamPanel(combo);
|
||||
var panel = GetLeadInPanel(combo);
|
||||
if (panel != null)
|
||||
BuildParamControls(panel, combo.SelectedIndex);
|
||||
BuildLeadInParamControls(panel, combo.SelectedIndex);
|
||||
}
|
||||
|
||||
private Panel GetParamPanel(ComboBox combo)
|
||||
private void OnLeadOutTypeChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (combo == cboExternalLeadIn) return pnlExternalParams;
|
||||
if (combo == cboInternalLeadIn) return pnlInternalParams;
|
||||
if (combo == cboArcCircleLeadIn) return pnlArcCircleParams;
|
||||
var combo = (ComboBox)sender;
|
||||
var panel = GetLeadOutPanel(combo);
|
||||
if (panel != null)
|
||||
BuildLeadOutParamControls(panel, combo.SelectedIndex);
|
||||
}
|
||||
|
||||
private Panel GetLeadInPanel(ComboBox combo)
|
||||
{
|
||||
if (combo == cboExternalLeadIn) return pnlExternalLeadIn;
|
||||
if (combo == cboInternalLeadIn) return pnlInternalLeadIn;
|
||||
if (combo == cboArcCircleLeadIn) return pnlArcCircleLeadIn;
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void BuildParamControls(Panel panel, int typeIndex)
|
||||
private Panel GetLeadOutPanel(ComboBox combo)
|
||||
{
|
||||
if (combo == cboExternalLeadOut) return pnlExternalLeadOut;
|
||||
if (combo == cboInternalLeadOut) return pnlInternalLeadOut;
|
||||
if (combo == cboArcCircleLeadOut) return pnlArcCircleLeadOut;
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void BuildLeadInParamControls(Panel panel, int typeIndex)
|
||||
{
|
||||
panel.Controls.Clear();
|
||||
var y = 0;
|
||||
@@ -155,18 +246,37 @@ namespace OpenNest.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private static void BuildLeadOutParamControls(Panel panel, int typeIndex)
|
||||
{
|
||||
panel.Controls.Clear();
|
||||
var y = 0;
|
||||
|
||||
switch (typeIndex)
|
||||
{
|
||||
case 1: // Line
|
||||
AddNumericField(panel, "Length:", 0.25, ref y, "Length");
|
||||
AddNumericField(panel, "Approach Angle:", 90, ref y, "ApproachAngle");
|
||||
break;
|
||||
case 2: // Arc
|
||||
AddNumericField(panel, "Radius:", 0.25, ref y, "Radius");
|
||||
break;
|
||||
case 3: // Microtab
|
||||
AddNumericField(panel, "Gap Size:", 0.06, ref y, "GapSize");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddNumericField(Panel panel, string label, double defaultValue,
|
||||
ref int y, string tag)
|
||||
{
|
||||
var lbl = new Label
|
||||
panel.Controls.Add(new Label
|
||||
{
|
||||
Text = label,
|
||||
Location = new System.Drawing.Point(0, y + 3),
|
||||
AutoSize = true
|
||||
};
|
||||
panel.Controls.Add(lbl);
|
||||
});
|
||||
|
||||
var nud = new System.Windows.Forms.NumericUpDown
|
||||
panel.Controls.Add(new NumericUpDown
|
||||
{
|
||||
Location = new System.Drawing.Point(130, y),
|
||||
Size = new System.Drawing.Size(120, 22),
|
||||
@@ -176,22 +286,25 @@ namespace OpenNest.Forms
|
||||
Maximum = 9999,
|
||||
Value = (decimal)defaultValue,
|
||||
Tag = tag
|
||||
};
|
||||
panel.Controls.Add(nud);
|
||||
});
|
||||
|
||||
y += 30;
|
||||
}
|
||||
|
||||
private void LoadFromParameters(CuttingParameters p)
|
||||
{
|
||||
LoadLeadIn(cboExternalLeadIn, pnlExternalParams, p.ExternalLeadIn);
|
||||
LoadLeadOut(cboExternalLeadOut, p.ExternalLeadOut);
|
||||
LoadLeadIn(cboExternalLeadIn, pnlExternalLeadIn, p.ExternalLeadIn);
|
||||
LoadLeadOut(cboExternalLeadOut, pnlExternalLeadOut, p.ExternalLeadOut);
|
||||
|
||||
LoadLeadIn(cboInternalLeadIn, pnlInternalParams, p.InternalLeadIn);
|
||||
LoadLeadOut(cboInternalLeadOut, p.InternalLeadOut);
|
||||
LoadLeadIn(cboInternalLeadIn, pnlInternalLeadIn, p.InternalLeadIn);
|
||||
LoadLeadOut(cboInternalLeadOut, pnlInternalLeadOut, p.InternalLeadOut);
|
||||
|
||||
LoadLeadIn(cboArcCircleLeadIn, pnlArcCircleParams, p.ArcCircleLeadIn);
|
||||
LoadLeadOut(cboArcCircleLeadOut, p.ArcCircleLeadOut);
|
||||
LoadLeadIn(cboArcCircleLeadIn, pnlArcCircleLeadIn, p.ArcCircleLeadIn);
|
||||
LoadLeadOut(cboArcCircleLeadOut, pnlArcCircleLeadOut, p.ArcCircleLeadOut);
|
||||
|
||||
chkTabsEnabled.Checked = p.TabsEnabled;
|
||||
if (p.TabConfig != null)
|
||||
nudTabWidth.Value = (decimal)p.TabConfig.Size;
|
||||
}
|
||||
|
||||
private static void LoadLeadIn(ComboBox combo, Panel panel, LeadIn leadIn)
|
||||
@@ -232,18 +345,22 @@ namespace OpenNest.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private static void LoadLeadOut(ComboBox combo, LeadOut leadOut)
|
||||
private static void LoadLeadOut(ComboBox combo, Panel panel, LeadOut leadOut)
|
||||
{
|
||||
switch (leadOut)
|
||||
{
|
||||
case LineLeadOut _:
|
||||
case LineLeadOut line:
|
||||
combo.SelectedIndex = 1;
|
||||
SetParam(panel, "Length", line.Length);
|
||||
SetParam(panel, "ApproachAngle", line.ApproachAngle);
|
||||
break;
|
||||
case ArcLeadOut _:
|
||||
case ArcLeadOut arc:
|
||||
combo.SelectedIndex = 2;
|
||||
SetParam(panel, "Radius", arc.Radius);
|
||||
break;
|
||||
case MicrotabLeadOut _:
|
||||
case MicrotabLeadOut microtab:
|
||||
combo.SelectedIndex = 3;
|
||||
SetParam(panel, "GapSize", microtab.GapSize);
|
||||
break;
|
||||
default:
|
||||
combo.SelectedIndex = 0;
|
||||
@@ -255,12 +372,14 @@ namespace OpenNest.Forms
|
||||
{
|
||||
var p = new CuttingParameters
|
||||
{
|
||||
ExternalLeadIn = BuildLeadIn(cboExternalLeadIn, pnlExternalParams),
|
||||
ExternalLeadOut = BuildLeadOut(cboExternalLeadOut),
|
||||
InternalLeadIn = BuildLeadIn(cboInternalLeadIn, pnlInternalParams),
|
||||
InternalLeadOut = BuildLeadOut(cboInternalLeadOut),
|
||||
ArcCircleLeadIn = BuildLeadIn(cboArcCircleLeadIn, pnlArcCircleParams),
|
||||
ArcCircleLeadOut = BuildLeadOut(cboArcCircleLeadOut)
|
||||
ExternalLeadIn = BuildLeadIn(cboExternalLeadIn, pnlExternalLeadIn),
|
||||
ExternalLeadOut = BuildLeadOut(cboExternalLeadOut, pnlExternalLeadOut),
|
||||
InternalLeadIn = BuildLeadIn(cboInternalLeadIn, pnlInternalLeadIn),
|
||||
InternalLeadOut = BuildLeadOut(cboInternalLeadOut, pnlInternalLeadOut),
|
||||
ArcCircleLeadIn = BuildLeadIn(cboArcCircleLeadIn, pnlArcCircleLeadIn),
|
||||
ArcCircleLeadOut = BuildLeadOut(cboArcCircleLeadOut, pnlArcCircleLeadOut),
|
||||
TabsEnabled = chkTabsEnabled.Checked,
|
||||
TabConfig = new NormalTab { Size = (double)nudTabWidth.Value }
|
||||
};
|
||||
return p;
|
||||
}
|
||||
@@ -307,16 +426,26 @@ namespace OpenNest.Forms
|
||||
}
|
||||
}
|
||||
|
||||
private static LeadOut BuildLeadOut(ComboBox combo)
|
||||
private static LeadOut BuildLeadOut(ComboBox combo, Panel panel)
|
||||
{
|
||||
switch (combo.SelectedIndex)
|
||||
{
|
||||
case 1:
|
||||
return new LineLeadOut { Length = 0.25, ApproachAngle = 90 };
|
||||
return new LineLeadOut
|
||||
{
|
||||
Length = GetParam(panel, "Length", 0.25),
|
||||
ApproachAngle = GetParam(panel, "ApproachAngle", 90)
|
||||
};
|
||||
case 2:
|
||||
return new ArcLeadOut { Radius = 0.25 };
|
||||
return new ArcLeadOut
|
||||
{
|
||||
Radius = GetParam(panel, "Radius", 0.25)
|
||||
};
|
||||
case 3:
|
||||
return new MicrotabLeadOut();
|
||||
return new MicrotabLeadOut
|
||||
{
|
||||
GapSize = GetParam(panel, "GapSize", 0.06)
|
||||
};
|
||||
default:
|
||||
return new NoLeadOut();
|
||||
}
|
||||
@@ -326,7 +455,7 @@ namespace OpenNest.Forms
|
||||
{
|
||||
foreach (Control c in panel.Controls)
|
||||
{
|
||||
if (c is System.Windows.Forms.NumericUpDown nud && (string)nud.Tag == tag)
|
||||
if (c is NumericUpDown nud && (string)nud.Tag == tag)
|
||||
{
|
||||
nud.Value = (decimal)value;
|
||||
return;
|
||||
@@ -338,7 +467,7 @@ namespace OpenNest.Forms
|
||||
{
|
||||
foreach (Control c in panel.Controls)
|
||||
{
|
||||
if (c is System.Windows.Forms.NumericUpDown nud && (string)nud.Tag == tag)
|
||||
if (c is NumericUpDown nud && (string)nud.Tag == tag)
|
||||
return (double)nud.Value;
|
||||
}
|
||||
return defaultValue;
|
||||
|
||||
116
OpenNest/Forms/SequenceForm.Designer.cs
generated
116
OpenNest/Forms/SequenceForm.Designer.cs
generated
@@ -28,77 +28,75 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.numericUpDown1 = new OpenNest.Controls.NumericUpDown();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
label1 = new System.Windows.Forms.Label();
|
||||
numericUpDown1 = new OpenNest.Controls.NumericUpDown();
|
||||
tableLayoutPanel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDown1).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.ColumnCount = 2;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.numericUpDown1, 1, 0);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 1;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(220, 36);
|
||||
this.tableLayoutPanel1.TabIndex = 0;
|
||||
tableLayoutPanel1.ColumnCount = 2;
|
||||
tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
tableLayoutPanel1.Controls.Add(label1, 0, 0);
|
||||
tableLayoutPanel1.Controls.Add(numericUpDown1, 1, 0);
|
||||
tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
tableLayoutPanel1.RowCount = 1;
|
||||
tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
tableLayoutPanel1.Size = new System.Drawing.Size(266, 35);
|
||||
tableLayoutPanel1.TabIndex = 0;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(3, 11);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(62, 13);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Sequence :";
|
||||
label1.Anchor = System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new System.Drawing.Point(4, 10);
|
||||
label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new System.Drawing.Size(64, 15);
|
||||
label1.TabIndex = 0;
|
||||
label1.Text = "Sequence :";
|
||||
//
|
||||
// numericUpDown1
|
||||
//
|
||||
this.numericUpDown1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.numericUpDown1.Location = new System.Drawing.Point(71, 8);
|
||||
this.numericUpDown1.Minimum = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericUpDown1.Name = "numericUpDown1";
|
||||
this.numericUpDown1.Size = new System.Drawing.Size(146, 20);
|
||||
this.numericUpDown1.TabIndex = 1;
|
||||
this.numericUpDown1.Value = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericUpDown1.Leave += new System.EventHandler(this.numericUpDown1_Leave);
|
||||
numericUpDown1.Anchor = System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
|
||||
numericUpDown1.Location = new System.Drawing.Point(76, 6);
|
||||
numericUpDown1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
numericUpDown1.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
|
||||
numericUpDown1.Name = "numericUpDown1";
|
||||
numericUpDown1.Size = new System.Drawing.Size(186, 23);
|
||||
numericUpDown1.Suffix = "";
|
||||
numericUpDown1.TabIndex = 1;
|
||||
numericUpDown1.Value = new decimal(new int[] { 1, 0, 0, 0 });
|
||||
numericUpDown1.Leave += numericUpDown1_Leave;
|
||||
//
|
||||
// SequenceForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(220, 36);
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Location = new System.Drawing.Point(100, 100);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "SequenceForm";
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
||||
this.Text = "Set Sequence";
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.tableLayoutPanel1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
ClientSize = new System.Drawing.Size(266, 35);
|
||||
ControlBox = false;
|
||||
Controls.Add(tableLayoutPanel1);
|
||||
FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
Location = new System.Drawing.Point(100, 100);
|
||||
Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
MaximizeBox = false;
|
||||
MinimizeBox = false;
|
||||
MinimumSize = new System.Drawing.Size(268, 74);
|
||||
Name = "SequenceForm";
|
||||
ShowIcon = false;
|
||||
ShowInTaskbar = false;
|
||||
StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
||||
Text = "Set Sequence";
|
||||
tableLayoutPanel1.ResumeLayout(false);
|
||||
tableLayoutPanel1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)numericUpDown1).EndInit();
|
||||
ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
@@ -26,36 +26,36 @@
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace OpenNest
|
||||
{
|
||||
programIdFont = new Font(SystemFonts.DefaultFont, FontStyle.Bold | FontStyle.Underline);
|
||||
SelectedColor = Color.FromArgb(90, 150, 200, 255);
|
||||
leadInPen = new Pen(Color.Yellow, 1.5f);
|
||||
leadInPen = new Pen(Color.OrangeRed, 1.5f);
|
||||
}
|
||||
|
||||
private LayoutPart(Part part)
|
||||
|
||||
Reference in New Issue
Block a user