From e92208b8c07aa2056ebf0da26ed72c9185e63598 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Mon, 6 Apr 2026 08:02:28 -0400 Subject: [PATCH] fix: remove import spline precision setting entirely Spline import now uses SplineConverter (arc-based) so the configurable precision parameter is obsolete. Removed the setting from the options dialog, DxfImporter property, Settings files, and all callsites. Hardcoded 200 as the sampling density for the intermediate point evaluation that feeds into SplineConverter. Co-Authored-By: Claude Opus 4.6 (1M context) --- OpenNest.IO/DxfImporter.cs | 4 +- OpenNest.IO/Extensions.cs | 4 +- .../Bending/SolidWorksBendDetectorTests.cs | 2 +- .../Geometry/EllipseConverterTests.cs | 2 +- OpenNest/Forms/CadConverterForm.cs | 2 - OpenNest/Forms/OptionsForm.Designer.cs | 57 +++---------------- OpenNest/Forms/OptionsForm.cs | 2 - OpenNest/Properties/Settings.Designer.cs | 14 +---- OpenNest/Properties/Settings.settings | 3 - OpenNest/app.config | 3 - 10 files changed, 13 insertions(+), 80 deletions(-) diff --git a/OpenNest.IO/DxfImporter.cs b/OpenNest.IO/DxfImporter.cs index 31cc738..20e6321 100644 --- a/OpenNest.IO/DxfImporter.cs +++ b/OpenNest.IO/DxfImporter.cs @@ -10,8 +10,6 @@ namespace OpenNest.IO { public class DxfImporter { - public int SplinePrecision { get; set; } - public DxfImporter() { } @@ -45,7 +43,7 @@ namespace OpenNest.IO break; case ACadSharp.Entities.Spline spline: - foreach (var e in spline.ToOpenNest(SplinePrecision)) + foreach (var e in spline.ToOpenNest()) { if (e is Line l) lines.Add(l); else if (e is Arc a) arcs.Add(a); diff --git a/OpenNest.IO/Extensions.cs b/OpenNest.IO/Extensions.cs index bdd818a..34fab3b 100644 --- a/OpenNest.IO/Extensions.cs +++ b/OpenNest.IO/Extensions.cs @@ -57,7 +57,7 @@ namespace OpenNest.IO return result; } - public static List ToOpenNest(this Spline spline, int precision) + public static List ToOpenNest(this Spline spline) { var layer = spline.Layer.ToOpenNest(); var color = spline.ResolveColor(); @@ -67,7 +67,7 @@ namespace OpenNest.IO List curvePoints; try { - curvePoints = spline.PolygonalVertexes(precision > 0 ? precision : 200); + curvePoints = spline.PolygonalVertexes(200); } catch (Exception ex) { diff --git a/OpenNest.Tests/Bending/SolidWorksBendDetectorTests.cs b/OpenNest.Tests/Bending/SolidWorksBendDetectorTests.cs index 2dacdd8..4949fbb 100644 --- a/OpenNest.Tests/Bending/SolidWorksBendDetectorTests.cs +++ b/OpenNest.Tests/Bending/SolidWorksBendDetectorTests.cs @@ -35,7 +35,7 @@ public class SolidWorksBendDetectorTests var path = Path.Combine(AppContext.BaseDirectory, "Bending", "TestData", "4526 A14 PT11 Test.dxf"); Assert.True(File.Exists(path), $"Test DXF not found: {path}"); - var importer = new OpenNest.IO.DxfImporter { SplinePrecision = 200 }; + var importer = new OpenNest.IO.DxfImporter(); var result = importer.Import(path); // EllipseConverter now produces arcs directly during import, diff --git a/OpenNest.Tests/Geometry/EllipseConverterTests.cs b/OpenNest.Tests/Geometry/EllipseConverterTests.cs index d1dad0c..25ef54d 100644 --- a/OpenNest.Tests/Geometry/EllipseConverterTests.cs +++ b/OpenNest.Tests/Geometry/EllipseConverterTests.cs @@ -228,7 +228,7 @@ public class EllipseConverterTests using (var writer = new ACadSharp.IO.DxfWriter(stream, doc, false)) writer.Write(); - var importer = new OpenNest.IO.DxfImporter { SplinePrecision = 200 }; + var importer = new OpenNest.IO.DxfImporter(); var result = importer.Import(tempPath); var arcCount = result.Entities.Count(e => e is Arc); diff --git a/OpenNest/Forms/CadConverterForm.cs b/OpenNest/Forms/CadConverterForm.cs index fa1f184..d9b44cd 100644 --- a/OpenNest/Forms/CadConverterForm.cs +++ b/OpenNest/Forms/CadConverterForm.cs @@ -75,7 +75,6 @@ namespace OpenNest.Forms try { var importer = new DxfImporter(); - importer.SplinePrecision = Settings.Default.ImportSplinePrecision; var result = importer.Import(file); if (result.Entities.Count == 0) @@ -385,7 +384,6 @@ namespace OpenNest.Forms // Re-import geometry but keep bends from the split drawing var importer = new DxfImporter(); - importer.SplinePrecision = Settings.Default.ImportSplinePrecision; var result = importer.Import(splitPath); var splitItem = new FileListItem diff --git a/OpenNest/Forms/OptionsForm.Designer.cs b/OpenNest/Forms/OptionsForm.Designer.cs index da16adf..993d03d 100644 --- a/OpenNest/Forms/OptionsForm.Designer.cs +++ b/OpenNest/Forms/OptionsForm.Designer.cs @@ -33,11 +33,9 @@ this.label1 = new System.Windows.Forms.Label(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.numericUpDown1 = new OpenNest.Controls.NumericUpDown(); - this.label2 = new System.Windows.Forms.Label(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.textBox1 = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); - this.numericUpDown2 = new OpenNest.Controls.NumericUpDown(); this.button1 = new System.Windows.Forms.Button(); this.saveButton = new System.Windows.Forms.Button(); this.cancelButton = new System.Windows.Forms.Button(); @@ -46,7 +44,6 @@ this.strategyGroupBox = new System.Windows.Forms.GroupBox(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); this.tableLayoutPanel1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit(); this.bottomPanel1.SuspendLayout(); this.SuspendLayout(); // @@ -87,17 +84,7 @@ this.numericUpDown1.Suffix = ""; this.numericUpDown1.TabIndex = 4; this.toolTip1.SetToolTip(this.numericUpDown1, "The amount to round the plate size up."); - // - // label2 - // - this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(3, 92); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(145, 16); - this.label2.TabIndex = 5; - this.label2.Text = "Import spline precision:\r\n"; - // + // // tableLayoutPanel1 // this.tableLayoutPanel1.ColumnCount = 4; @@ -107,19 +94,16 @@ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F)); this.tableLayoutPanel1.Controls.Add(this.label1, 0, 1); this.tableLayoutPanel1.Controls.Add(this.textBox1, 1, 0); - this.tableLayoutPanel1.Controls.Add(this.label2, 0, 2); this.tableLayoutPanel1.Controls.Add(this.label3, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.checkBox1, 0, 3); - this.tableLayoutPanel1.Controls.Add(this.numericUpDown2, 1, 2); + this.tableLayoutPanel1.Controls.Add(this.checkBox1, 0, 2); this.tableLayoutPanel1.Controls.Add(this.numericUpDown1, 1, 1); this.tableLayoutPanel1.Controls.Add(this.button1, 3, 0); this.tableLayoutPanel1.Location = new System.Drawing.Point(12, 12); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 4; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F)); + this.tableLayoutPanel1.RowCount = 3; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.34F)); this.tableLayoutPanel1.Size = new System.Drawing.Size(684, 160); this.tableLayoutPanel1.TabIndex = 0; // @@ -141,31 +125,7 @@ this.label3.Size = new System.Drawing.Size(145, 16); this.label3.TabIndex = 0; this.label3.Text = "Nest Template Path:"; - // - // numericUpDown2 - // - this.numericUpDown2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.numericUpDown2.Location = new System.Drawing.Point(154, 89); - this.numericUpDown2.Maximum = new decimal(new int[] { - 360, - 0, - 0, - 0}); - this.numericUpDown2.Minimum = new decimal(new int[] { - 3, - 0, - 0, - 0}); - this.numericUpDown2.Name = "numericUpDown2"; - this.numericUpDown2.Size = new System.Drawing.Size(130, 22); - this.numericUpDown2.Suffix = ""; - this.numericUpDown2.TabIndex = 6; - this.numericUpDown2.Value = new decimal(new int[] { - 200, - 0, - 0, - 0}); - // + // // button1 // this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); @@ -259,7 +219,6 @@ ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit(); this.bottomPanel1.ResumeLayout(false); this.ResumeLayout(false); @@ -273,8 +232,6 @@ private System.Windows.Forms.Label label1; private Controls.NumericUpDown numericUpDown1; private System.Windows.Forms.ToolTip toolTip1; - private System.Windows.Forms.Label label2; - private Controls.NumericUpDown numericUpDown2; private Controls.BottomPanel bottomPanel1; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.TextBox textBox1; diff --git a/OpenNest/Forms/OptionsForm.cs b/OpenNest/Forms/OptionsForm.cs index 067baad..2b959a1 100644 --- a/OpenNest/Forms/OptionsForm.cs +++ b/OpenNest/Forms/OptionsForm.cs @@ -67,7 +67,6 @@ namespace OpenNest.Forms textBox1.Text = Settings.Default.NestTemplatePath; checkBox1.Checked = Settings.Default.CreateNewNestOnOpen; numericUpDown1.Value = (decimal)Settings.Default.AutoSizePlateFactor; - numericUpDown2.Value = (decimal)Settings.Default.ImportSplinePrecision; var disabledNames = ParseDisabledStrategies(Settings.Default.DisabledStrategies); foreach (DataGridViewRow row in strategyGrid.Rows) @@ -79,7 +78,6 @@ namespace OpenNest.Forms Settings.Default.NestTemplatePath = textBox1.Text; Settings.Default.CreateNewNestOnOpen = checkBox1.Checked; Settings.Default.AutoSizePlateFactor = (double)numericUpDown1.Value; - Settings.Default.ImportSplinePrecision = (int)numericUpDown2.Value; var disabledNames = new List(); foreach (DataGridViewRow row in strategyGrid.Rows) diff --git a/OpenNest/Properties/Settings.Designer.cs b/OpenNest/Properties/Settings.Designer.cs index 7e44f3c..8c27954 100644 --- a/OpenNest/Properties/Settings.Designer.cs +++ b/OpenNest/Properties/Settings.Designer.cs @@ -118,19 +118,7 @@ namespace OpenNest.Properties { this["NestNumber"] = value; } } - - [global::System.Configuration.UserScopedSettingAttribute()] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("200")] - public int ImportSplinePrecision { - get { - return ((int)(this["ImportSplinePrecision"])); - } - set { - this["ImportSplinePrecision"] = value; - } - } - + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("Inches")] diff --git a/OpenNest/Properties/Settings.settings b/OpenNest/Properties/Settings.settings index cc3fd9b..540e00b 100644 --- a/OpenNest/Properties/Settings.settings +++ b/OpenNest/Properties/Settings.settings @@ -26,9 +26,6 @@ 1 - - 200 - Inches diff --git a/OpenNest/app.config b/OpenNest/app.config index 1290afd..ee4f6f0 100644 --- a/OpenNest/app.config +++ b/OpenNest/app.config @@ -32,9 +32,6 @@ 1 - - 200 - Inches