diff --git a/OpenNest/Forms/EditNestForm.Designer.cs b/OpenNest/Forms/EditNestForm.Designer.cs index c7abf3e..456b9b8 100644 --- a/OpenNest/Forms/EditNestForm.Designer.cs +++ b/OpenNest/Forms/EditNestForm.Designer.cs @@ -38,6 +38,7 @@ this.qtyColumn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.toolStrip1 = new System.Windows.Forms.ToolStrip(); this.toolStripButton1 = new System.Windows.Forms.ToolStripButton(); + this.btnAssignLeadIns = 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(); @@ -133,7 +134,8 @@ this.toolStrip1.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden; this.toolStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripButton1}); + this.toolStripButton1, + this.btnAssignLeadIns}); this.toolStrip1.Location = new System.Drawing.Point(3, 3); this.toolStrip1.Name = "toolStrip1"; this.toolStrip1.Size = new System.Drawing.Size(227, 31); @@ -151,7 +153,16 @@ this.toolStripButton1.Size = new System.Drawing.Size(38, 28); this.toolStripButton1.Text = "Calculate Cut Time"; this.toolStripButton1.Click += new System.EventHandler(this.CalculateSelectedPlateCutTime_Click); - // + // + // btnAssignLeadIns + // + this.btnAssignLeadIns.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.btnAssignLeadIns.ImageTransparentColor = System.Drawing.Color.Magenta; + this.btnAssignLeadIns.Name = "btnAssignLeadIns"; + this.btnAssignLeadIns.Size = new System.Drawing.Size(96, 28); + this.btnAssignLeadIns.Text = "Assign Lead-ins"; + this.btnAssignLeadIns.Click += new System.EventHandler(this.AssignLeadIns_Click); + // // tabPage2 // this.tabPage2.Controls.Add(this.drawingListBox1); @@ -266,5 +277,6 @@ private System.Windows.Forms.ToolStripButton toolStripButton2; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripButton toolStripButton3; + private System.Windows.Forms.ToolStripButton btnAssignLeadIns; } } \ No newline at end of file diff --git a/OpenNest/Forms/EditNestForm.cs b/OpenNest/Forms/EditNestForm.cs index df96031..0ad53d0 100644 --- a/OpenNest/Forms/EditNestForm.cs +++ b/OpenNest/Forms/EditNestForm.cs @@ -2,6 +2,7 @@ using OpenNest.CNC.CuttingStrategy; using OpenNest.Collections; using OpenNest.Controls; +using OpenNest.Engine; using OpenNest.Engine.Sequencing; using OpenNest.IO; using OpenNest.Math; @@ -711,6 +712,32 @@ namespace OpenNest.Forms CalculateCurrentPlateCutTime(); } + private void AssignLeadIns_Click(object sender, EventArgs e) + { + if (PlateView?.Plate == null) + return; + + var plate = PlateView.Plate; + + using var form = new CuttingParametersForm(); + if (plate.CuttingParameters != null) + form.Parameters = plate.CuttingParameters; + + if (form.ShowDialog(this) != DialogResult.OK) + return; + + var parameters = form.BuildParameters(); + plate.CuttingParameters = parameters; + + var assigner = new LeadInAssigner + { + Sequencer = new LeftSideSequencer() + }; + assigner.Assign(plate); + + PlateView.Invalidate(); + } + private void ImportDrawings_Click(object sender, EventArgs e) { Import();