fix: improve arc-tangency fitting and add layered engrave/cut passes for GravographIS
GeometrySimplifier/ArcFit now fit arcs that pass exactly through run endpoints while balancing tangency error between trusted and estimated directions, fixing arcs that previously bulged or broke tangent continuity at fillet/compound-curve junctions. GravographIS post processor gains per-layer (engrave/cut) tool passes via a new GravographISPostConfig, so ENGRAVE/ETCH-tagged geometry runs as a separate scribe pass with its own feed/depth and an operator pause before the cut pass (spring-floated spindle needs a tool swap). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
using System.Collections.Generic;
|
||||
using OpenNest.CNC;
|
||||
using OpenNest.Geometry;
|
||||
using OpenNest.Posts.GravographIS;
|
||||
|
||||
namespace OpenNest.Tests.GravographIS;
|
||||
|
||||
public class GravographISPostProcessorTests
|
||||
{
|
||||
private static LayeredPolyline Poly(LayerType layer, params Vector[] pts)
|
||||
=> new LayeredPolyline(new List<Vector>(pts), layer);
|
||||
|
||||
[Fact]
|
||||
public void BuildPasses_EngraveAndCut_OrdersEngraveFirstThenCutWithPause()
|
||||
{
|
||||
var post = new GravographISPostProcessor();
|
||||
|
||||
var passes = post.BuildPasses(new[]
|
||||
{
|
||||
Poly(LayerType.Cut, new Vector(0, 0), new Vector(1, 0)),
|
||||
Poly(LayerType.Scribe, new Vector(0, 0), new Vector(0, 1)),
|
||||
});
|
||||
|
||||
Assert.Equal(2, passes.Count);
|
||||
|
||||
Assert.Equal(post.Config.Engrave.FeedMmPerSec, passes[0].FeedMmPerSec);
|
||||
Assert.False(passes[0].PauseBefore);
|
||||
|
||||
Assert.Equal(post.Config.Cut.FeedMmPerSec, passes[1].FeedMmPerSec);
|
||||
Assert.True(passes[1].PauseBefore);
|
||||
Assert.Equal("Change tool", passes[1].PauseMessage);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BuildPasses_CutOnly_IsSinglePass()
|
||||
{
|
||||
var post = new GravographISPostProcessor();
|
||||
|
||||
var passes = post.BuildPasses(new[]
|
||||
{
|
||||
Poly(LayerType.Cut, new Vector(0, 0), new Vector(1, 0)),
|
||||
});
|
||||
|
||||
Assert.Single(passes);
|
||||
Assert.Equal(post.Config.Cut.FeedMmPerSec, passes[0].FeedMmPerSec);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BuildPasses_SkipsDisplayGeometry()
|
||||
{
|
||||
var post = new GravographISPostProcessor();
|
||||
|
||||
var passes = post.BuildPasses(new[]
|
||||
{
|
||||
Poly(LayerType.Display, new Vector(0, 0), new Vector(1, 0)),
|
||||
Poly(LayerType.Cut, new Vector(0, 0), new Vector(0, 1)),
|
||||
});
|
||||
|
||||
Assert.Single(passes);
|
||||
Assert.Equal(post.Config.Cut.FeedMmPerSec, passes[0].FeedMmPerSec);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Config_IsExposedThroughConfigurableInterface()
|
||||
{
|
||||
var post = new GravographISPostProcessor(new GravographISPostConfig());
|
||||
OpenNest.IConfigurablePostProcessor configurable = post;
|
||||
Assert.Same(post.Config, configurable.Config);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user