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) <noreply@anthropic.com>
This commit is contained in:
2026-04-06 08:02:28 -04:00
parent 297ebee45b
commit e92208b8c0
10 changed files with 13 additions and 80 deletions
+1 -3
View File
@@ -10,8 +10,6 @@ namespace OpenNest.IO
{ {
public class DxfImporter public class DxfImporter
{ {
public int SplinePrecision { get; set; }
public DxfImporter() public DxfImporter()
{ {
} }
@@ -45,7 +43,7 @@ namespace OpenNest.IO
break; break;
case ACadSharp.Entities.Spline spline: 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); if (e is Line l) lines.Add(l);
else if (e is Arc a) arcs.Add(a); else if (e is Arc a) arcs.Add(a);
+2 -2
View File
@@ -57,7 +57,7 @@ namespace OpenNest.IO
return result; return result;
} }
public static List<Geometry.Entity> ToOpenNest(this Spline spline, int precision) public static List<Geometry.Entity> ToOpenNest(this Spline spline)
{ {
var layer = spline.Layer.ToOpenNest(); var layer = spline.Layer.ToOpenNest();
var color = spline.ResolveColor(); var color = spline.ResolveColor();
@@ -67,7 +67,7 @@ namespace OpenNest.IO
List<XYZ> curvePoints; List<XYZ> curvePoints;
try try
{ {
curvePoints = spline.PolygonalVertexes(precision > 0 ? precision : 200); curvePoints = spline.PolygonalVertexes(200);
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -35,7 +35,7 @@ public class SolidWorksBendDetectorTests
var path = Path.Combine(AppContext.BaseDirectory, "Bending", "TestData", "4526 A14 PT11 Test.dxf"); var path = Path.Combine(AppContext.BaseDirectory, "Bending", "TestData", "4526 A14 PT11 Test.dxf");
Assert.True(File.Exists(path), $"Test DXF not found: {path}"); 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); var result = importer.Import(path);
// EllipseConverter now produces arcs directly during import, // EllipseConverter now produces arcs directly during import,
@@ -228,7 +228,7 @@ public class EllipseConverterTests
using (var writer = new ACadSharp.IO.DxfWriter(stream, doc, false)) using (var writer = new ACadSharp.IO.DxfWriter(stream, doc, false))
writer.Write(); writer.Write();
var importer = new OpenNest.IO.DxfImporter { SplinePrecision = 200 }; var importer = new OpenNest.IO.DxfImporter();
var result = importer.Import(tempPath); var result = importer.Import(tempPath);
var arcCount = result.Entities.Count(e => e is Arc); var arcCount = result.Entities.Count(e => e is Arc);
-2
View File
@@ -75,7 +75,6 @@ namespace OpenNest.Forms
try try
{ {
var importer = new DxfImporter(); var importer = new DxfImporter();
importer.SplinePrecision = Settings.Default.ImportSplinePrecision;
var result = importer.Import(file); var result = importer.Import(file);
if (result.Entities.Count == 0) if (result.Entities.Count == 0)
@@ -385,7 +384,6 @@ namespace OpenNest.Forms
// Re-import geometry but keep bends from the split drawing // Re-import geometry but keep bends from the split drawing
var importer = new DxfImporter(); var importer = new DxfImporter();
importer.SplinePrecision = Settings.Default.ImportSplinePrecision;
var result = importer.Import(splitPath); var result = importer.Import(splitPath);
var splitItem = new FileListItem var splitItem = new FileListItem
+5 -48
View File
@@ -33,11 +33,9 @@
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.numericUpDown1 = new OpenNest.Controls.NumericUpDown(); this.numericUpDown1 = new OpenNest.Controls.NumericUpDown();
this.label2 = new System.Windows.Forms.Label();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox1 = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.numericUpDown2 = new OpenNest.Controls.NumericUpDown();
this.button1 = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button();
this.saveButton = new System.Windows.Forms.Button(); this.saveButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button(); this.cancelButton = new System.Windows.Forms.Button();
@@ -46,7 +44,6 @@
this.strategyGroupBox = new System.Windows.Forms.GroupBox(); this.strategyGroupBox = new System.Windows.Forms.GroupBox();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
this.bottomPanel1.SuspendLayout(); this.bottomPanel1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
@@ -88,16 +85,6 @@
this.numericUpDown1.TabIndex = 4; this.numericUpDown1.TabIndex = 4;
this.toolTip1.SetToolTip(this.numericUpDown1, "The amount to round the plate size up."); 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 // tableLayoutPanel1
// //
this.tableLayoutPanel1.ColumnCount = 4; 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.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.label1, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.textBox1, 1, 0); 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.label3, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.checkBox1, 0, 3); this.tableLayoutPanel1.Controls.Add(this.checkBox1, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.numericUpDown2, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.numericUpDown1, 1, 1); this.tableLayoutPanel1.Controls.Add(this.numericUpDown1, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.button1, 3, 0); this.tableLayoutPanel1.Controls.Add(this.button1, 3, 0);
this.tableLayoutPanel1.Location = new System.Drawing.Point(12, 12); this.tableLayoutPanel1.Location = new System.Drawing.Point(12, 12);
this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 4; this.tableLayoutPanel1.RowCount = 3;
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, 33.33F));
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, 33.33F));
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, 33.34F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(684, 160); this.tableLayoutPanel1.Size = new System.Drawing.Size(684, 160);
this.tableLayoutPanel1.TabIndex = 0; this.tableLayoutPanel1.TabIndex = 0;
// //
@@ -142,30 +126,6 @@
this.label3.TabIndex = 0; this.label3.TabIndex = 0;
this.label3.Text = "Nest Template Path:"; 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 // button1
// //
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); 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(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout(); this.tableLayoutPanel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
this.bottomPanel1.ResumeLayout(false); this.bottomPanel1.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
@@ -273,8 +232,6 @@
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private Controls.NumericUpDown numericUpDown1; private Controls.NumericUpDown numericUpDown1;
private System.Windows.Forms.ToolTip toolTip1; private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.Label label2;
private Controls.NumericUpDown numericUpDown2;
private Controls.BottomPanel bottomPanel1; private Controls.BottomPanel bottomPanel1;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox textBox1;
-2
View File
@@ -67,7 +67,6 @@ namespace OpenNest.Forms
textBox1.Text = Settings.Default.NestTemplatePath; textBox1.Text = Settings.Default.NestTemplatePath;
checkBox1.Checked = Settings.Default.CreateNewNestOnOpen; checkBox1.Checked = Settings.Default.CreateNewNestOnOpen;
numericUpDown1.Value = (decimal)Settings.Default.AutoSizePlateFactor; numericUpDown1.Value = (decimal)Settings.Default.AutoSizePlateFactor;
numericUpDown2.Value = (decimal)Settings.Default.ImportSplinePrecision;
var disabledNames = ParseDisabledStrategies(Settings.Default.DisabledStrategies); var disabledNames = ParseDisabledStrategies(Settings.Default.DisabledStrategies);
foreach (DataGridViewRow row in strategyGrid.Rows) foreach (DataGridViewRow row in strategyGrid.Rows)
@@ -79,7 +78,6 @@ namespace OpenNest.Forms
Settings.Default.NestTemplatePath = textBox1.Text; Settings.Default.NestTemplatePath = textBox1.Text;
Settings.Default.CreateNewNestOnOpen = checkBox1.Checked; Settings.Default.CreateNewNestOnOpen = checkBox1.Checked;
Settings.Default.AutoSizePlateFactor = (double)numericUpDown1.Value; Settings.Default.AutoSizePlateFactor = (double)numericUpDown1.Value;
Settings.Default.ImportSplinePrecision = (int)numericUpDown2.Value;
var disabledNames = new List<string>(); var disabledNames = new List<string>();
foreach (DataGridViewRow row in strategyGrid.Rows) foreach (DataGridViewRow row in strategyGrid.Rows)
-12
View File
@@ -119,18 +119,6 @@ namespace OpenNest.Properties {
} }
} }
[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.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Inches")] [global::System.Configuration.DefaultSettingValueAttribute("Inches")]
-3
View File
@@ -26,9 +26,6 @@
<Setting Name="NestNumber" Type="System.Int32" Scope="User"> <Setting Name="NestNumber" Type="System.Int32" Scope="User">
<Value Profile="(Default)">1</Value> <Value Profile="(Default)">1</Value>
</Setting> </Setting>
<Setting Name="ImportSplinePrecision" Type="System.Int32" Scope="User">
<Value Profile="(Default)">200</Value>
</Setting>
<Setting Name="DefaultUnit" Type="OpenNest.Units" Scope="User"> <Setting Name="DefaultUnit" Type="OpenNest.Units" Scope="User">
<Value Profile="(Default)">Inches</Value> <Value Profile="(Default)">Inches</Value>
</Setting> </Setting>
-3
View File
@@ -32,9 +32,6 @@
<setting name="NestNumber" serializeAs="String"> <setting name="NestNumber" serializeAs="String">
<value>1</value> <value>1</value>
</setting> </setting>
<setting name="ImportSplinePrecision" serializeAs="String">
<value>200</value>
</setting>
<setting name="DefaultUnit" serializeAs="String"> <setting name="DefaultUnit" serializeAs="String">
<value>Inches</value> <value>Inches</value>
</setting> </setting>