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>
49 lines
1.1 KiB
C#
49 lines
1.1 KiB
C#
using System.Collections.Generic;
|
|
using OpenNest.Geometry;
|
|
|
|
namespace OpenNest.CNC
|
|
{
|
|
public class RapidMove : Motion
|
|
{
|
|
public RapidMove()
|
|
{
|
|
Feedrate = CNC.Feedrate.UseMax;
|
|
}
|
|
|
|
public RapidMove(Vector endPoint)
|
|
{
|
|
EndPoint = endPoint;
|
|
}
|
|
|
|
public RapidMove(double x, double y)
|
|
{
|
|
EndPoint = new Vector(x, y);
|
|
}
|
|
|
|
public override CodeType Type
|
|
{
|
|
get { return CodeType.RapidMove; }
|
|
}
|
|
|
|
public override ICode Clone()
|
|
{
|
|
return new RapidMove(EndPoint)
|
|
{
|
|
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("G00 X{0} Y{1}", EndPoint.X.ToString(dp), EndPoint.Y.ToString(dp));
|
|
}
|
|
}
|
|
}
|