feat: add MachineConfig, MaterialConfig, MachineSummary with parameter lookup
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
26
OpenNest.Data/MachineConfig.cs
Normal file
26
OpenNest.Data/MachineConfig.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using OpenNest.Math;
|
||||
|
||||
namespace OpenNest.Data;
|
||||
|
||||
public class MachineConfig
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
public int SchemaVersion { get; set; } = 1;
|
||||
public string Name { get; set; } = "";
|
||||
public MachineType Type { get; set; } = MachineType.Laser;
|
||||
public UnitSystem Units { get; set; } = UnitSystem.Inches;
|
||||
public List<MaterialConfig> Materials { get; set; } = new();
|
||||
|
||||
public ThicknessConfig? GetParameters(string material, double thickness)
|
||||
{
|
||||
var mat = GetMaterial(material);
|
||||
if (mat is null) return null;
|
||||
return mat.Thicknesses.FirstOrDefault(t => t.Value.IsEqualTo(thickness));
|
||||
}
|
||||
|
||||
public MaterialConfig? GetMaterial(string name)
|
||||
{
|
||||
return Materials.FirstOrDefault(m =>
|
||||
string.Equals(m.Name, name, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
}
|
||||
3
OpenNest.Data/MachineSummary.cs
Normal file
3
OpenNest.Data/MachineSummary.cs
Normal file
@@ -0,0 +1,3 @@
|
||||
namespace OpenNest.Data;
|
||||
|
||||
public record MachineSummary(Guid Id, string Name);
|
||||
9
OpenNest.Data/MaterialConfig.cs
Normal file
9
OpenNest.Data/MaterialConfig.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace OpenNest.Data;
|
||||
|
||||
public class MaterialConfig
|
||||
{
|
||||
public string Name { get; set; } = "";
|
||||
public string Grade { get; set; } = "";
|
||||
public double Density { get; set; }
|
||||
public List<ThicknessConfig> Thicknesses { get; set; } = new();
|
||||
}
|
||||
@@ -3,6 +3,8 @@
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<RootNamespace>OpenNest.Data</RootNamespace>
|
||||
<AssemblyName>OpenNest.Data</AssemblyName>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\OpenNest.Core\OpenNest.Core.csproj" />
|
||||
|
||||
Reference in New Issue
Block a user