mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-06 11:15:44 -05:00
The Cincinnati CL post always drew an "incomplete final rapid sequence" warning because it never declared IPostVerificationSupport. It writes etch features before cuts, inserts or drops rapids, and with part sub-programs rapids to each part's corner, so it cannot declare it unconditionally. IPostVerificationSupport gains a nest-aware PlacedProgramOrderChange(nest) (null = preserved; otherwise the reason, shown in the warning). The CL post answers it from its own writer: part sub-programs and smart rapids off, and every part's and hole's posted motions exactly equal to its placed ones. Plan Cutting cuts scribes first, so planned nests qualify. CNC output is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
64 lines
2.4 KiB
C#
64 lines
2.4 KiB
C#
using OpenNest.CNC.CuttingStrategy;
|
|
using OpenNest.Diagnostics;
|
|
using OpenNest.Geometry;
|
|
using OpenNest.Posts.Cincinnati;
|
|
using OpenNest.Posts.CincinnatiCIFiber;
|
|
using OpenNest.Posts.GravographIS;
|
|
|
|
namespace OpenNest.Tests.Diagnostics;
|
|
|
|
public class PostVerificationPostContractTests
|
|
{
|
|
[Fact]
|
|
public void ReorderingPostRequiresAcknowledgmentEvenWhenNestChecksAreClear()
|
|
{
|
|
var nest = ClearNest();
|
|
Assert.False(PostVerificationAnalyzer.Analyze(nest).HasWarnings);
|
|
var post = new GravographISPostProcessor(new GravographISPostConfig());
|
|
var report = PostVerificationAnalyzer.AnalyzeForPost(nest, post);
|
|
Assert.Contains(report.Findings, finding => finding.Kind == PostVerificationKind.Incomplete);
|
|
Assert.False(report.CanPost(false));
|
|
Assert.True(report.CanPost(true));
|
|
Assert.Contains(post.Name, report.ToDisplayText());
|
|
}
|
|
|
|
[Fact]
|
|
public void CincinnatiClDeclaresPlacedOrderOnlyWhenThisNestPostsInIt()
|
|
{
|
|
var report = PostVerificationAnalyzer.AnalyzeForPost(ClearNest(),
|
|
new CincinnatiPostProcessor(new CincinnatiPostConfig()));
|
|
Assert.Empty(report.Findings);
|
|
Assert.True(report.CanPost(false));
|
|
|
|
var subprograms = PostVerificationAnalyzer.AnalyzeForPost(ClearNest(),
|
|
new CincinnatiPostProcessor(new CincinnatiPostConfig { UsePartSubprograms = true }));
|
|
Assert.Contains(subprograms.Findings, finding => finding.Kind == PostVerificationKind.Incomplete);
|
|
Assert.False(subprograms.CanPost(false));
|
|
}
|
|
|
|
[Fact]
|
|
public void CIFiberUsesPlacedOrderWithoutAnExtraOrderWarning()
|
|
{
|
|
var report = PostVerificationAnalyzer.AnalyzeForPost(ClearNest(),
|
|
new CIFiberPostProcessor(new CIFiberPostConfig()));
|
|
Assert.Empty(report.Findings);
|
|
Assert.True(report.CanPost(false));
|
|
}
|
|
|
|
private static Nest ClearNest()
|
|
{
|
|
var program = new OpenNest.CNC.Program();
|
|
program.MoveTo(0, 0);
|
|
program.LineTo(4, 0);
|
|
program.LineTo(4, 4);
|
|
program.LineTo(0, 4);
|
|
program.LineTo(0, 0);
|
|
var part = new Part(new Drawing("square", program));
|
|
part.ApplyLeadIns(new CuttingParameters { ExternalLeadIn = new LineLeadIn { Length = 0.5 } },
|
|
new Vector(-2, -2));
|
|
var nest = new Nest();
|
|
nest.CreatePlate().Parts.Add(part);
|
|
return nest;
|
|
}
|
|
}
|