diff --git a/OpenNest/Forms/SplitDrawingForm.Designer.cs b/OpenNest/Forms/SplitDrawingForm.Designer.cs index dc2ca13..6b05865 100644 --- a/OpenNest/Forms/SplitDrawingForm.Designer.cs +++ b/OpenNest/Forms/SplitDrawingForm.Designer.cs @@ -51,6 +51,8 @@ namespace OpenNest.Forms this.nudPlateHeight = new System.Windows.Forms.NumericUpDown(); this.lblEdgeSpacing = new System.Windows.Forms.Label(); this.nudEdgeSpacing = new System.Windows.Forms.NumericUpDown(); + this.lblSplitAxis = new System.Windows.Forms.Label(); + this.cboSplitAxis = new System.Windows.Forms.ComboBox(); // By Count group this.grpByCount = new System.Windows.Forms.GroupBox(); @@ -219,11 +221,13 @@ namespace OpenNest.Forms this.grpAutoFit.Dock = System.Windows.Forms.DockStyle.Top; this.grpAutoFit.Location = new System.Drawing.Point(6, 101); this.grpAutoFit.Name = "grpAutoFit"; - this.grpAutoFit.Size = new System.Drawing.Size(208, 105); + this.grpAutoFit.Size = new System.Drawing.Size(208, 132); this.grpAutoFit.TabIndex = 1; this.grpAutoFit.TabStop = false; this.grpAutoFit.Text = "Auto-Fit Options"; this.grpAutoFit.Visible = false; + this.grpAutoFit.Controls.Add(this.cboSplitAxis); + this.grpAutoFit.Controls.Add(this.lblSplitAxis); this.grpAutoFit.Controls.Add(this.nudEdgeSpacing); this.grpAutoFit.Controls.Add(this.lblEdgeSpacing); this.grpAutoFit.Controls.Add(this.nudPlateHeight); @@ -284,6 +288,23 @@ namespace OpenNest.Forms this.nudEdgeSpacing.Value = new decimal(new int[] { 5, 0, 0, 131072 }); this.nudEdgeSpacing.ValueChanged += new System.EventHandler(this.OnAutoFitValueChanged); + // lblSplitAxis + this.lblSplitAxis.AutoSize = true; + this.lblSplitAxis.Location = new System.Drawing.Point(10, 103); + this.lblSplitAxis.Name = "lblSplitAxis"; + this.lblSplitAxis.Size = new System.Drawing.Size(60, 15); + this.lblSplitAxis.Text = "Split Axis:"; + + // cboSplitAxis + this.cboSplitAxis.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cboSplitAxis.Items.AddRange(new object[] { "Auto", "Vertical Only", "Horizontal Only" }); + this.cboSplitAxis.Location = new System.Drawing.Point(110, 100); + this.cboSplitAxis.Name = "cboSplitAxis"; + this.cboSplitAxis.Size = new System.Drawing.Size(88, 23); + this.cboSplitAxis.TabIndex = 3; + this.cboSplitAxis.SelectedIndex = 0; + this.cboSplitAxis.SelectedIndexChanged += new System.EventHandler(this.OnAutoFitValueChanged); + // ---- By Count Group ---- this.grpByCount.Dock = System.Windows.Forms.DockStyle.Top; this.grpByCount.Location = new System.Drawing.Point(6, 206); @@ -607,6 +628,8 @@ namespace OpenNest.Forms private System.Windows.Forms.NumericUpDown nudPlateHeight; private System.Windows.Forms.Label lblEdgeSpacing; private System.Windows.Forms.NumericUpDown nudEdgeSpacing; + private System.Windows.Forms.Label lblSplitAxis; + private System.Windows.Forms.ComboBox cboSplitAxis; private System.Windows.Forms.GroupBox grpByCount; private System.Windows.Forms.Label lblHorizontalPieces; diff --git a/OpenNest/Forms/SplitDrawingForm.cs b/OpenNest/Forms/SplitDrawingForm.cs index 06f0398..489c146 100644 --- a/OpenNest/Forms/SplitDrawingForm.cs +++ b/OpenNest/Forms/SplitDrawingForm.cs @@ -70,7 +70,16 @@ public partial class SplitDrawingForm : Form var plateH = (double)nudPlateHeight.Value; var spacing = (double)nudEdgeSpacing.Value; var overhang = GetCurrentParameters().FeatureOverhang; - _splitLines.AddRange(AutoSplitCalculator.FitToPlate(_drawingBounds, plateW, plateH, spacing, overhang)); + var lines = AutoSplitCalculator.FitToPlate(_drawingBounds, plateW, plateH, spacing, overhang); + + // Filter by user-selected axis + var axisIndex = cboSplitAxis.SelectedIndex; + if (axisIndex == 1) // Vertical Only + lines = lines.Where(l => l.Axis == CutOffAxis.Vertical).ToList(); + else if (axisIndex == 2) // Horizontal Only + lines = lines.Where(l => l.Axis == CutOffAxis.Horizontal).ToList(); + + _splitLines.AddRange(lines); } else if (radByCount.Checked) {