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:
31
OpenNest.Posts.Cincinnati/MaterialLibraryNameConverter.cs
Normal file
31
OpenNest.Posts.Cincinnati/MaterialLibraryNameConverter.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenNest.Posts.Cincinnati
|
||||
{
|
||||
public sealed class MaterialLibraryNameConverter : StringConverter
|
||||
{
|
||||
public override bool GetStandardValuesSupported(ITypeDescriptorContext context) => true;
|
||||
|
||||
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context) => false;
|
||||
|
||||
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
|
||||
{
|
||||
var config = context?.Instance as CincinnatiPostConfig;
|
||||
var names = new List<string> { "" };
|
||||
|
||||
if (config?.MaterialLibraries != null)
|
||||
{
|
||||
names.AddRange(config.MaterialLibraries
|
||||
.Select(e => e.Library)
|
||||
.Where(s => !string.IsNullOrWhiteSpace(s))
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||
.OrderBy(s => s, StringComparer.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
return new StandardValuesCollection(names);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user