diff --git a/OpenNest/Forms/MainForm.Designer.cs b/OpenNest/Forms/MainForm.Designer.cs index 77be625..f699040 100644 --- a/OpenNest/Forms/MainForm.Designer.cs +++ b/OpenNest/Forms/MainForm.Designer.cs @@ -131,6 +131,7 @@ plateIndexStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); plateSizeStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); plateQtyStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); + plateUtilStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); gpuStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); selectionStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); toolStrip1 = new System.Windows.Forms.ToolStrip(); @@ -829,7 +830,7 @@ // // statusStrip1 // - statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { statusLabel1, locationStatusLabel, selectionStatusLabel, spacerLabel, plateIndexStatusLabel, plateSizeStatusLabel, plateQtyStatusLabel, gpuStatusLabel }); + statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { statusLabel1, locationStatusLabel, selectionStatusLabel, spacerLabel, plateIndexStatusLabel, plateSizeStatusLabel, plateQtyStatusLabel, plateUtilStatusLabel, gpuStatusLabel }); statusStrip1.Location = new System.Drawing.Point(0, 630); statusStrip1.Name = "statusStrip1"; statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 16, 0); @@ -889,7 +890,15 @@ plateQtyStatusLabel.Padding = new System.Windows.Forms.Padding(5, 0, 5, 0); plateQtyStatusLabel.Size = new System.Drawing.Size(55, 19); plateQtyStatusLabel.Text = "Qty : 0"; - // + // + // plateUtilStatusLabel + // + plateUtilStatusLabel.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Left; + plateUtilStatusLabel.Name = "plateUtilStatusLabel"; + plateUtilStatusLabel.Padding = new System.Windows.Forms.Padding(5, 0, 5, 0); + plateUtilStatusLabel.Size = new System.Drawing.Size(75, 19); + plateUtilStatusLabel.Text = "Util : 0.0%"; + // // gpuStatusLabel // gpuStatusLabel.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Left; @@ -1128,6 +1137,7 @@ private System.Windows.Forms.ToolStripSeparator toolStripMenuItem10; private System.Windows.Forms.ToolStripMenuItem mnuCloseAll; private System.Windows.Forms.ToolStripStatusLabel plateQtyStatusLabel; + private System.Windows.Forms.ToolStripStatusLabel plateUtilStatusLabel; private System.Windows.Forms.ToolStripMenuItem mnuFileExportAll; private System.Windows.Forms.ToolStripMenuItem openNestToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem pEPToolStripMenuItem; diff --git a/OpenNest/Forms/MainForm.cs b/OpenNest/Forms/MainForm.cs index 66ef482..79c9fbf 100644 --- a/OpenNest/Forms/MainForm.cs +++ b/OpenNest/Forms/MainForm.cs @@ -204,6 +204,7 @@ namespace OpenNest.Forms plateIndexStatusLabel.Text = string.Empty; plateSizeStatusLabel.Text = string.Empty; plateQtyStatusLabel.Text = string.Empty; + plateUtilStatusLabel.Text = string.Empty; return; } @@ -219,6 +220,10 @@ namespace OpenNest.Forms plateQtyStatusLabel.Text = string.Format( "Qty: {0}", activeForm.PlateView.Plate.Quantity); + + plateUtilStatusLabel.Text = string.Format( + "Util: {0:P1}", + activeForm.PlateView.Plate.Utilization()); } private void UpdateSelectionStatus() @@ -342,6 +347,8 @@ namespace OpenNest.Forms activeForm.PlateView.MouseClick -= PlateView_MouseClick; activeForm.PlateView.StatusChanged -= PlateView_StatusChanged; activeForm.PlateView.SelectionChanged -= PlateView_SelectionChanged; + activeForm.PlateView.PartAdded -= PlateView_PartAdded; + activeForm.PlateView.PartRemoved -= PlateView_PartRemoved; } // If nesting is in progress and the active form changed, cancel nesting @@ -367,6 +374,8 @@ namespace OpenNest.Forms UpdateSelectionStatus(); activeForm.PlateView.StatusChanged += PlateView_StatusChanged; activeForm.PlateView.SelectionChanged += PlateView_SelectionChanged; + activeForm.PlateView.PartAdded += PlateView_PartAdded; + activeForm.PlateView.PartRemoved += PlateView_PartRemoved; mnuViewDrawRapids.Checked = activeForm.PlateView.DrawRapid; mnuViewDrawBounds.Checked = activeForm.PlateView.DrawBounds; statusLabel1.Text = activeForm.PlateView.Status; @@ -1215,6 +1224,9 @@ namespace OpenNest.Forms #region PlateView Events + private void PlateView_PartAdded(object sender, ItemAddedEventArgs e) => UpdatePlateStatus(); + private void PlateView_PartRemoved(object sender, ItemRemovedEventArgs e) => UpdatePlateStatus(); + private void PlateView_MouseMove(object sender, MouseEventArgs e) { UpdateLocationStatus();