feat: add Motion.Suppressed property to mark tab-gap codes
Adds Suppressed bool to the Motion base class so LinearMove, ArcMove, and RapidMove can be flagged for skip during rendering and post-processing when they fall within a tab gap. Clone() updated on all three subclasses to preserve the flag. Covered by new MotionSuppressedTests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -65,7 +65,8 @@ namespace OpenNest.CNC
|
||||
{
|
||||
return new ArcMove(EndPoint, CenterPoint, Rotation)
|
||||
{
|
||||
Layer = Layer
|
||||
Layer = Layer,
|
||||
Suppressed = Suppressed
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,8 @@ namespace OpenNest.CNC
|
||||
{
|
||||
return new LinearMove(EndPoint)
|
||||
{
|
||||
Layer = Layer
|
||||
Layer = Layer,
|
||||
Suppressed = Suppressed
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ namespace OpenNest.CNC
|
||||
|
||||
public int Feedrate { get; set; }
|
||||
|
||||
public bool Suppressed { get; set; }
|
||||
|
||||
protected Motion()
|
||||
{
|
||||
Feedrate = CNC.Feedrate.UseDefault;
|
||||
|
||||
@@ -26,7 +26,10 @@ namespace OpenNest.CNC
|
||||
|
||||
public override ICode Clone()
|
||||
{
|
||||
return new RapidMove(EndPoint);
|
||||
return new RapidMove(EndPoint)
|
||||
{
|
||||
Suppressed = Suppressed
|
||||
};
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
||||
45
OpenNest.Tests/MotionSuppressedTests.cs
Normal file
45
OpenNest.Tests/MotionSuppressedTests.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using OpenNest.CNC;
|
||||
using OpenNest.Geometry;
|
||||
|
||||
namespace OpenNest.Tests;
|
||||
|
||||
public class MotionSuppressedTests
|
||||
{
|
||||
[Fact]
|
||||
public void LinearMove_Suppressed_DefaultsFalse()
|
||||
{
|
||||
var move = new LinearMove(new Vector(1, 2));
|
||||
Assert.False(move.Suppressed);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ArcMove_Suppressed_DefaultsFalse()
|
||||
{
|
||||
var move = new ArcMove(new Vector(1, 2), new Vector(0, 0));
|
||||
Assert.False(move.Suppressed);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RapidMove_Suppressed_DefaultsFalse()
|
||||
{
|
||||
var move = new RapidMove(new Vector(1, 2));
|
||||
Assert.False(move.Suppressed);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Suppressed_CanBeSet()
|
||||
{
|
||||
var move = new LinearMove(new Vector(1, 2));
|
||||
move.Suppressed = true;
|
||||
Assert.True(move.Suppressed);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Clone_PreservesSuppressed()
|
||||
{
|
||||
var move = new LinearMove(new Vector(1, 2));
|
||||
move.Suppressed = true;
|
||||
var clone = (LinearMove)move.Clone();
|
||||
Assert.True(clone.Suppressed);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user