feat: add Offset property to SubProgramCall for hole positioning

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-09 14:26:55 -04:00
parent de6877ac48
commit c270d8ea76
2 changed files with 54 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
using OpenNest.Math;
using OpenNest.Geometry;
using OpenNest.Math;
namespace OpenNest.CNC
{
@@ -35,6 +36,12 @@ namespace OpenNest.CNC
}
}
/// <summary>
/// Gets or sets the offset (position) at which the sub-program is executed.
/// For hole sub-programs, this is the hole center.
/// </summary>
public Vector Offset { get; set; }
/// <summary>
/// Gets or sets the rotation of the program in degrees.
/// </summary>
@@ -78,11 +85,13 @@ namespace OpenNest.CNC
/// <returns></returns>
public ICode Clone()
{
return new SubProgramCall(program, Rotation);
return new SubProgramCall(program, Rotation) { Id = Id, Offset = Offset };
}
public override string ToString()
{
if (Offset.X != 0 || Offset.Y != 0)
return string.Format("G65 P{0} X{1} Y{2}", Id, Offset.X, Offset.Y);
return string.Format("G65 P{0} R{1}", Id, Rotation);
}
}