mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-10-21 01:31:36 -04:00
The engine argument's description now names every built-in engine with what it suits, so a model can choose one; omitting it still means Default. The fill tools resolve an omitted strategy to Fill directly instead of through the session's whole-job default. Front-end tests cover the MCP and console defaults and keep the description in step with the registry's built-ins.
69 lines
1.9 KiB
C#
69 lines
1.9 KiB
C#
using System.Collections.Generic;
|
|
|
|
namespace OpenNest.Mcp
|
|
{
|
|
public class NestSession
|
|
{
|
|
public Nest Nest { get; set; }
|
|
public List<Plate> Plates { get; } = new();
|
|
public List<Drawing> Drawings { get; } = new();
|
|
|
|
/// <summary>
|
|
/// Whole-job engine <c>autonest_plate</c> uses when a call does not pass an explicit
|
|
/// <c>engine</c> argument; fill tools default to the Fill strategy instead. Instance state
|
|
/// only — the process-global legacy registry is never read or written.
|
|
/// </summary>
|
|
public string DefaultEngineName { get; set; } = "Default";
|
|
|
|
public Plate GetPlate(int index)
|
|
{
|
|
if (Nest != null && index < Nest.Plates.Count)
|
|
return Nest.Plates[index];
|
|
|
|
var adjustedIndex = index - (Nest?.Plates.Count ?? 0);
|
|
if (adjustedIndex >= 0 && adjustedIndex < Plates.Count)
|
|
return Plates[adjustedIndex];
|
|
|
|
return null;
|
|
}
|
|
|
|
public Drawing GetDrawing(string name)
|
|
{
|
|
if (Nest != null)
|
|
{
|
|
foreach (var d in Nest.Drawings)
|
|
{
|
|
if (d.Name == name)
|
|
return d;
|
|
}
|
|
}
|
|
|
|
foreach (var d in Drawings)
|
|
{
|
|
if (d.Name == name)
|
|
return d;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
public List<Plate> AllPlates()
|
|
{
|
|
var all = new List<Plate>();
|
|
if (Nest != null)
|
|
all.AddRange(Nest.Plates);
|
|
all.AddRange(Plates);
|
|
return all;
|
|
}
|
|
|
|
public List<Drawing> AllDrawings()
|
|
{
|
|
var all = new List<Drawing>();
|
|
if (Nest != null)
|
|
all.AddRange(Nest.Drawings);
|
|
all.AddRange(Drawings);
|
|
return all;
|
|
}
|
|
}
|
|
}
|