feat: add plate utilization to UI status bar

Display current plate utilization percentage in the status bar,
updating live when parts are added or removed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-21 00:10:42 -04:00
parent 9887cb1aa3
commit de527cd668
2 changed files with 24 additions and 2 deletions

View File

@@ -131,6 +131,7 @@
plateIndexStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); plateIndexStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
plateSizeStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); plateSizeStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
plateQtyStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); plateQtyStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
plateUtilStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
gpuStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); gpuStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
selectionStatusLabel = new System.Windows.Forms.ToolStripStatusLabel(); selectionStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
toolStrip1 = new System.Windows.Forms.ToolStrip(); toolStrip1 = new System.Windows.Forms.ToolStrip();
@@ -829,7 +830,7 @@
// //
// statusStrip1 // 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.Location = new System.Drawing.Point(0, 630);
statusStrip1.Name = "statusStrip1"; statusStrip1.Name = "statusStrip1";
statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 16, 0); 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.Padding = new System.Windows.Forms.Padding(5, 0, 5, 0);
plateQtyStatusLabel.Size = new System.Drawing.Size(55, 19); plateQtyStatusLabel.Size = new System.Drawing.Size(55, 19);
plateQtyStatusLabel.Text = "Qty : 0"; 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
// //
gpuStatusLabel.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Left; gpuStatusLabel.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Left;
@@ -1128,6 +1137,7 @@
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem10; private System.Windows.Forms.ToolStripSeparator toolStripMenuItem10;
private System.Windows.Forms.ToolStripMenuItem mnuCloseAll; private System.Windows.Forms.ToolStripMenuItem mnuCloseAll;
private System.Windows.Forms.ToolStripStatusLabel plateQtyStatusLabel; private System.Windows.Forms.ToolStripStatusLabel plateQtyStatusLabel;
private System.Windows.Forms.ToolStripStatusLabel plateUtilStatusLabel;
private System.Windows.Forms.ToolStripMenuItem mnuFileExportAll; private System.Windows.Forms.ToolStripMenuItem mnuFileExportAll;
private System.Windows.Forms.ToolStripMenuItem openNestToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem openNestToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem pEPToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem pEPToolStripMenuItem;

View File

@@ -204,6 +204,7 @@ namespace OpenNest.Forms
plateIndexStatusLabel.Text = string.Empty; plateIndexStatusLabel.Text = string.Empty;
plateSizeStatusLabel.Text = string.Empty; plateSizeStatusLabel.Text = string.Empty;
plateQtyStatusLabel.Text = string.Empty; plateQtyStatusLabel.Text = string.Empty;
plateUtilStatusLabel.Text = string.Empty;
return; return;
} }
@@ -219,6 +220,10 @@ namespace OpenNest.Forms
plateQtyStatusLabel.Text = string.Format( plateQtyStatusLabel.Text = string.Format(
"Qty: {0}", "Qty: {0}",
activeForm.PlateView.Plate.Quantity); activeForm.PlateView.Plate.Quantity);
plateUtilStatusLabel.Text = string.Format(
"Util: {0:P1}",
activeForm.PlateView.Plate.Utilization());
} }
private void UpdateSelectionStatus() private void UpdateSelectionStatus()
@@ -342,6 +347,8 @@ namespace OpenNest.Forms
activeForm.PlateView.MouseClick -= PlateView_MouseClick; activeForm.PlateView.MouseClick -= PlateView_MouseClick;
activeForm.PlateView.StatusChanged -= PlateView_StatusChanged; activeForm.PlateView.StatusChanged -= PlateView_StatusChanged;
activeForm.PlateView.SelectionChanged -= PlateView_SelectionChanged; 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 // If nesting is in progress and the active form changed, cancel nesting
@@ -367,6 +374,8 @@ namespace OpenNest.Forms
UpdateSelectionStatus(); UpdateSelectionStatus();
activeForm.PlateView.StatusChanged += PlateView_StatusChanged; activeForm.PlateView.StatusChanged += PlateView_StatusChanged;
activeForm.PlateView.SelectionChanged += PlateView_SelectionChanged; activeForm.PlateView.SelectionChanged += PlateView_SelectionChanged;
activeForm.PlateView.PartAdded += PlateView_PartAdded;
activeForm.PlateView.PartRemoved += PlateView_PartRemoved;
mnuViewDrawRapids.Checked = activeForm.PlateView.DrawRapid; mnuViewDrawRapids.Checked = activeForm.PlateView.DrawRapid;
mnuViewDrawBounds.Checked = activeForm.PlateView.DrawBounds; mnuViewDrawBounds.Checked = activeForm.PlateView.DrawBounds;
statusLabel1.Text = activeForm.PlateView.Status; statusLabel1.Text = activeForm.PlateView.Status;
@@ -1215,6 +1224,9 @@ namespace OpenNest.Forms
#region PlateView Events #region PlateView Events
private void PlateView_PartAdded(object sender, ItemAddedEventArgs<Part> e) => UpdatePlateStatus();
private void PlateView_PartRemoved(object sender, ItemRemovedEventArgs<Part> e) => UpdatePlateStatus();
private void PlateView_MouseMove(object sender, MouseEventArgs e) private void PlateView_MouseMove(object sender, MouseEventArgs e)
{ {
UpdateLocationStatus(); UpdateLocationStatus();