Adds Dictionary<string,string> VariableRefs to Motion (cleared on Rotate/Offset) and string VariableRef to Feedrate, with deep-copy Clone() support, so post processors can emit variable references instead of literal coordinate values. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
53 lines
1.2 KiB
C#
53 lines
1.2 KiB
C#
using System.Collections.Generic;
|
|
using OpenNest.Geometry;
|
|
|
|
namespace OpenNest.CNC
|
|
{
|
|
public class LinearMove : Motion
|
|
{
|
|
public LinearMove()
|
|
: this(new Vector())
|
|
{
|
|
}
|
|
|
|
public LinearMove(double x, double y)
|
|
: this(new Vector(x, y))
|
|
{
|
|
}
|
|
|
|
public LinearMove(Vector endPoint)
|
|
{
|
|
EndPoint = endPoint;
|
|
Layer = LayerType.Cut;
|
|
}
|
|
|
|
public LayerType Layer { get; set; }
|
|
|
|
public override CodeType Type
|
|
{
|
|
get { return CodeType.LinearMove; }
|
|
}
|
|
|
|
public override ICode Clone()
|
|
{
|
|
return new LinearMove(EndPoint)
|
|
{
|
|
Layer = Layer,
|
|
Suppressed = Suppressed,
|
|
VariableRefs = VariableRefs != null ? new Dictionary<string, string>(VariableRefs) : null
|
|
};
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return ToString(DefaultDecimalPlaces);
|
|
}
|
|
|
|
public override string ToString(int decimalPlaces)
|
|
{
|
|
var dp = "N" + decimalPlaces;
|
|
return string.Format("G01 X{0} Y{1}", EndPoint.X.ToString(dp), EndPoint.Y.ToString(dp));
|
|
}
|
|
}
|
|
}
|