mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-10-15 11:11:54 -04:00
fix(desktop): warn about clamp settings on BOM import
BOM import read clamps.json without its status, so an unreadable or partly invalid file could give BOM-created nests no or partial clamps silently. New and BOM import now share one loader that warns once per session, and BOM import reads the settings when it creates the nests. The Clamps dialog no longer claims that all parts and nesting keep clear of clamps: it names Auto Nest and states that interactive fill and push, the overlap check and cutoffs do not avoid clamps yet. Review findings 7 and 9, Project Memory 4e5f566d.
This commit is contained in:
1 parent
fe7083f4c4
commit
5125a5f2f3
3 files changed
+12
-10
No files matched your search
@@ -18,7 +18,6 @@ namespace OpenNest.Forms
|
||||
private readonly BindingList<BomPartRow> _parts;
|
||||
private Dictionary<string, BomGroupPlateSettings> _groupSettings;
|
||||
private NestDefaults _defaults;
|
||||
private ClampSettings _clamps;
|
||||
|
||||
public Form MdiParentForm { get; set; }
|
||||
|
||||
@@ -31,7 +30,6 @@ namespace OpenNest.Forms
|
||||
dgvParts.DataSource = _parts;
|
||||
_groupSettings = new Dictionary<string, BomGroupPlateSettings>();
|
||||
_defaults = MainForm.LoadSavedNestDefaults(out _);
|
||||
_clamps = MainForm.LoadSavedClampSettings(out _);
|
||||
ApplyDefaults();
|
||||
}
|
||||
|
||||
@@ -412,6 +410,8 @@ namespace OpenNest.Forms
|
||||
var jobName = txtJobName.Text.Trim();
|
||||
var nestsCreated = 0;
|
||||
var importErrors = new List<string>();
|
||||
// Read when the nests are created, warning (once per session) like New does.
|
||||
var clamps = MainForm.LoadClampSettings(this);
|
||||
|
||||
foreach (var group in groups)
|
||||
{
|
||||
@@ -437,7 +437,7 @@ namespace OpenNest.Forms
|
||||
{
|
||||
// As New does: saved defaults, then the machine clamps in those units.
|
||||
_defaults.ApplyTo(nest);
|
||||
_clamps.ApplyToNewNest(nest);
|
||||
clamps.ApplyToNewNest(nest);
|
||||
}
|
||||
);
|
||||
importErrors.AddRange(result.Errors);
|
||||
|
||||
@@ -63,9 +63,10 @@ public sealed class ClampsForm : Form
|
||||
MaximumSize = new Size(450, 0),
|
||||
Padding = new Padding(0, 0, 0, 8),
|
||||
Text =
|
||||
"Fixed clamps along the plate edge through the origin. Parts and nesting keep "
|
||||
+ "clear of each clamp by the plate's bottom edge spacing. Clamps that do not "
|
||||
+ "reach a shorter plate are left off it.",
|
||||
"Fixed clamps along the plate edge through the origin. Auto Nest keeps parts "
|
||||
+ "clear of each clamp by the plate's bottom edge spacing; clamps that do not "
|
||||
+ "reach a shorter plate are left off it. Interactive fill and push, the "
|
||||
+ "overlap check and cutoffs do not avoid clamps yet.",
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -198,16 +198,16 @@ namespace OpenNest.Forms
|
||||
var nest = new Nest();
|
||||
LoadNestDefaults().ApplyTo(nest);
|
||||
// After the defaults so the rail is converted to the new nest's units.
|
||||
LoadClampSettings().ApplyToNewNest(nest);
|
||||
LoadClampSettings(this).ApplyToNewNest(nest);
|
||||
return nest;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads the machine clamp settings (see <see cref="LoadSavedClampSettings"/>); an
|
||||
/// Loads the machine clamp settings for creating new nests (New, BOM import); an
|
||||
/// unreadable or partly invalid file warns once per session, because the new nest's
|
||||
/// clamps may not match the machine.
|
||||
/// </summary>
|
||||
private ClampSettings LoadClampSettings()
|
||||
internal static ClampSettings LoadClampSettings(IWin32Window owner)
|
||||
{
|
||||
var settings = LoadSavedClampSettings(out var status);
|
||||
|
||||
@@ -222,6 +222,7 @@ namespace OpenNest.Forms
|
||||
? "could not be read, so new nests have no clamps"
|
||||
: "has invalid values that were ignored, so new nests may be missing clamps";
|
||||
MessageBox.Show(
|
||||
owner,
|
||||
$"The clamp settings file {problem}:\n{ClampSettings.DefaultPath}\n\nCheck the clamps in Nest > Clamps and use Save as Machine Defaults to rewrite the file.",
|
||||
"Clamps",
|
||||
MessageBoxButtons.OK,
|
||||
@@ -231,7 +232,7 @@ namespace OpenNest.Forms
|
||||
return settings;
|
||||
}
|
||||
|
||||
private bool clampSettingsWarned;
|
||||
private static bool clampSettingsWarned;
|
||||
|
||||
/// <summary>The single desktop entry point for the persisted machine clamp settings.</summary>
|
||||
internal static ClampSettings LoadSavedClampSettings(out ClampSettingsStatus status) =>
|
||||
|
||||
Reference in new issue
Block a user