feat: add Remove Lead-ins button to EditNestForm toolbar

Clears all manual lead-ins from every part on the active plate and
rebuilds the layout graphics.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-30 19:36:01 -04:00
parent 428dbdb03c
commit e94a556f23
2 changed files with 45 additions and 1 deletions

View File

@@ -40,6 +40,7 @@
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
this.btnAssignLeadIns = new System.Windows.Forms.ToolStripButton();
this.btnPlaceLeadIn = new System.Windows.Forms.ToolStripButton();
this.btnRemoveLeadIns = new System.Windows.Forms.ToolStripButton();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.drawingListBox1 = new OpenNest.Controls.DrawingListBox();
this.toolStrip2 = new System.Windows.Forms.ToolStrip();
@@ -137,7 +138,8 @@
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripButton1,
this.btnAssignLeadIns,
this.btnPlaceLeadIn});
this.btnPlaceLeadIn,
this.btnRemoveLeadIns});
this.toolStrip1.Location = new System.Drawing.Point(3, 3);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(227, 31);
@@ -174,6 +176,15 @@
this.btnPlaceLeadIn.Text = "Place Lead-in";
this.btnPlaceLeadIn.Click += new System.EventHandler(this.PlaceLeadIn_Click);
//
// btnRemoveLeadIns
//
this.btnRemoveLeadIns.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.btnRemoveLeadIns.ImageTransparentColor = System.Drawing.Color.Magenta;
this.btnRemoveLeadIns.Name = "btnRemoveLeadIns";
this.btnRemoveLeadIns.Size = new System.Drawing.Size(104, 28);
this.btnRemoveLeadIns.Text = "Remove Lead-ins";
this.btnRemoveLeadIns.Click += new System.EventHandler(this.RemoveLeadIns_Click);
//
// tabPage2
//
this.tabPage2.Controls.Add(this.drawingListBox1);
@@ -290,5 +301,6 @@
private System.Windows.Forms.ToolStripButton toolStripButton3;
private System.Windows.Forms.ToolStripButton btnAssignLeadIns;
private System.Windows.Forms.ToolStripButton btnPlaceLeadIn;
private System.Windows.Forms.ToolStripButton btnRemoveLeadIns;
}
}

View File

@@ -738,6 +738,38 @@ namespace OpenNest.Forms
PlateView.Invalidate();
}
private void RemoveLeadIns_Click(object sender, EventArgs e)
{
if (PlateView?.Plate == null)
return;
var plate = PlateView.Plate;
var count = 0;
foreach (var part in plate.Parts)
{
if (part.HasManualLeadIns)
{
part.RemoveLeadIns();
count++;
}
}
if (count == 0)
return;
plate.CuttingParameters = null;
// Rebuild all layout part graphics
foreach (var lp in PlateView.Parts)
{
lp.IsDirty = true;
lp.Update();
}
PlateView.Invalidate();
}
private void PlaceLeadIn_Click(object sender, EventArgs e)
{
if (PlateView?.Plate == null)