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:
@@ -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);
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace OpenNest.IO
|
||||
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 color = spline.ResolveColor();
|
||||
@@ -67,7 +67,7 @@ namespace OpenNest.IO
|
||||
List<XYZ> curvePoints;
|
||||
try
|
||||
{
|
||||
curvePoints = spline.PolygonalVertexes(precision > 0 ? precision : 200);
|
||||
curvePoints = spline.PolygonalVertexes(200);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
57
OpenNest/Forms/OptionsForm.Designer.cs
generated
57
OpenNest/Forms/OptionsForm.Designer.cs
generated
@@ -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;
|
||||
|
||||
@@ -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<string>();
|
||||
foreach (DataGridViewRow row in strategyGrid.Rows)
|
||||
|
||||
14
OpenNest/Properties/Settings.Designer.cs
generated
14
OpenNest/Properties/Settings.Designer.cs
generated
@@ -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")]
|
||||
|
||||
@@ -26,9 +26,6 @@
|
||||
<Setting Name="NestNumber" Type="System.Int32" Scope="User">
|
||||
<Value Profile="(Default)">1</Value>
|
||||
</Setting>
|
||||
<Setting Name="ImportSplinePrecision" Type="System.Int32" Scope="User">
|
||||
<Value Profile="(Default)">200</Value>
|
||||
</Setting>
|
||||
<Setting Name="DefaultUnit" Type="OpenNest.Units" Scope="User">
|
||||
<Value Profile="(Default)">Inches</Value>
|
||||
</Setting>
|
||||
|
||||
@@ -32,9 +32,6 @@
|
||||
<setting name="NestNumber" serializeAs="String">
|
||||
<value>1</value>
|
||||
</setting>
|
||||
<setting name="ImportSplinePrecision" serializeAs="String">
|
||||
<value>200</value>
|
||||
</setting>
|
||||
<setting name="DefaultUnit" serializeAs="String">
|
||||
<value>Inches</value>
|
||||
</setting>
|
||||
|
||||
Reference in New Issue
Block a user