feat: add Variables dictionary to Program with deep-copy in Clone

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-02 09:58:36 -04:00
parent 95b9613e2d
commit 27afa04e4a
2 changed files with 37 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
using OpenNest.Converters;
using OpenNest.Geometry;
using OpenNest.Math;
using System;
using System.Collections.Generic;
namespace OpenNest.CNC
@@ -9,6 +10,8 @@ namespace OpenNest.CNC
{
public List<ICode> Codes;
public Dictionary<string, VariableDefinition> Variables { get; } = new(StringComparer.OrdinalIgnoreCase);
private Mode mode;
public Program(Mode mode = Mode.Absolute)
@@ -454,6 +457,9 @@ namespace OpenNest.CNC
pgm.Codes.AddRange(codes);
foreach (var kvp in Variables)
pgm.Variables[kvp.Key] = kvp.Value;
return pgm;
}