feat(cincinnati): seed material library defaults and add selector dropdown
Adds the full Cincinnati material/etch library list as the committed default config (seeded into Posts/ on build only when no runtime config exists), plus a Selected Library override in the PropertyGrid backed by a TypeConverter that populates from MaterialLibraries. MainForm calls the new IPostProcessorNestAware hook before showing the config so the dropdown opens preselected to the best match by nest material and nearest thickness. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenNest.Posts.Cincinnati
|
||||
{
|
||||
@@ -277,6 +279,24 @@ namespace OpenNest.Posts.Cincinnati
|
||||
[DisplayName("Etch Libraries")]
|
||||
[Description("Gas-to-library mapping for etch operations.")]
|
||||
public List<EtchLibraryEntry> EtchLibraries { get; set; } = new();
|
||||
|
||||
[Category("B. Libraries")]
|
||||
[DisplayName("Selected Library")]
|
||||
[Description("Overrides Material/Thickness/Gas auto-resolution. Pick an existing entry from Material Libraries, or leave blank to auto-resolve.")]
|
||||
[TypeConverter(typeof(MaterialLibraryNameConverter))]
|
||||
public string SelectedLibrary { get; set; } = "";
|
||||
|
||||
public string FindBestLibrary(string materialName, double thickness)
|
||||
{
|
||||
if (MaterialLibraries == null || string.IsNullOrEmpty(materialName))
|
||||
return "";
|
||||
|
||||
return MaterialLibraries
|
||||
.Where(e => string.Equals(e.Material, materialName, StringComparison.OrdinalIgnoreCase))
|
||||
.OrderBy(e => System.Math.Abs(e.Thickness - thickness))
|
||||
.Select(e => e.Library)
|
||||
.FirstOrDefault() ?? "";
|
||||
}
|
||||
}
|
||||
|
||||
public class MaterialLibraryEntry
|
||||
|
||||
Reference in New Issue
Block a user