From d16ef36d34f1aef0366380c9c7066ac6884e326c Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Mon, 30 Mar 2026 15:08:18 -0400 Subject: [PATCH] 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) --- .../CuttingStrategy/ContourCuttingStrategy.cs | 4 + .../CNC/CuttingStrategy/LeadIns/LineLeadIn.cs | 2 +- .../CuttingStrategy/LeadIns/LineLineLeadIn.cs | 4 +- .../CuttingStrategy/LeadOuts/LineLeadOut.cs | 2 +- OpenNest.Core/SpecialLayers.cs | 4 +- .../Forms/CuttingParametersForm.Designer.cs | 16 +- OpenNest/Forms/CuttingParametersForm.cs | 263 +++++++++++++----- OpenNest/Forms/SequenceForm.Designer.cs | 116 ++++---- OpenNest/Forms/SequenceForm.resx | 54 ++-- OpenNest/LayoutPart.cs | 2 +- 10 files changed, 299 insertions(+), 168 deletions(-) diff --git a/OpenNest.Core/CNC/CuttingStrategy/ContourCuttingStrategy.cs b/OpenNest.Core/CNC/CuttingStrategy/ContourCuttingStrategy.cs index 08cb2bf..5d70ee5 100644 --- a/OpenNest.Core/CNC/CuttingStrategy/ContourCuttingStrategy.cs +++ b/OpenNest.Core/CNC/CuttingStrategy/ContourCuttingStrategy.cs @@ -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, diff --git a/OpenNest.Core/CNC/CuttingStrategy/LeadIns/LineLeadIn.cs b/OpenNest.Core/CNC/CuttingStrategy/LeadIns/LineLeadIn.cs index 4516070..261c872 100644 --- a/OpenNest.Core/CNC/CuttingStrategy/LeadIns/LineLeadIn.cs +++ b/OpenNest.Core/CNC/CuttingStrategy/LeadIns/LineLeadIn.cs @@ -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)); diff --git a/OpenNest.Core/CNC/CuttingStrategy/LeadIns/LineLineLeadIn.cs b/OpenNest.Core/CNC/CuttingStrategy/LeadIns/LineLineLeadIn.cs index e3ce6d1..fdfda0b 100644 --- a/OpenNest.Core/CNC/CuttingStrategy/LeadIns/LineLineLeadIn.cs +++ b/OpenNest.Core/CNC/CuttingStrategy/LeadIns/LineLineLeadIn.cs @@ -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); diff --git a/OpenNest.Core/CNC/CuttingStrategy/LeadOuts/LineLeadOut.cs b/OpenNest.Core/CNC/CuttingStrategy/LeadOuts/LineLeadOut.cs index 986d68f..70fa9d2 100644 --- a/OpenNest.Core/CNC/CuttingStrategy/LeadOuts/LineLeadOut.cs +++ b/OpenNest.Core/CNC/CuttingStrategy/LeadOuts/LineLeadOut.cs @@ -12,7 +12,7 @@ namespace OpenNest.CNC.CuttingStrategy public override List 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)); diff --git a/OpenNest.Core/SpecialLayers.cs b/OpenNest.Core/SpecialLayers.cs index 46d6578..5010647 100644 --- a/OpenNest.Core/SpecialLayers.cs +++ b/OpenNest.Core/SpecialLayers.cs @@ -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 }; } diff --git a/OpenNest/Forms/CuttingParametersForm.Designer.cs b/OpenNest/Forms/CuttingParametersForm.Designer.cs index 4fd7c4d..528b9d4 100644 --- a/OpenNest/Forms/CuttingParametersForm.Designer.cs +++ b/OpenNest/Forms/CuttingParametersForm.Designer.cs @@ -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))); diff --git a/OpenNest/Forms/CuttingParametersForm.cs b/OpenNest/Forms/CuttingParametersForm.cs index 94ad430..b0403a9 100644 --- a/OpenNest/Forms/CuttingParametersForm.cs +++ b/OpenNest/Forms/CuttingParametersForm.cs @@ -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; diff --git a/OpenNest/Forms/SequenceForm.Designer.cs b/OpenNest/Forms/SequenceForm.Designer.cs index e3d2d39..d49cbfe 100644 --- a/OpenNest/Forms/SequenceForm.Designer.cs +++ b/OpenNest/Forms/SequenceForm.Designer.cs @@ -28,77 +28,75 @@ /// 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); } diff --git a/OpenNest/Forms/SequenceForm.resx b/OpenNest/Forms/SequenceForm.resx index 1af7de1..8b2ff64 100644 --- a/OpenNest/Forms/SequenceForm.resx +++ b/OpenNest/Forms/SequenceForm.resx @@ -1,17 +1,17 @@  - diff --git a/OpenNest/LayoutPart.cs b/OpenNest/LayoutPart.cs index 9571fa7..2cb2e8f 100644 --- a/OpenNest/LayoutPart.cs +++ b/OpenNest/LayoutPart.cs @@ -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)