mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-27 18:31:34 -05:00
fix(ui): translate absolute-coordinate part paths by placement
Build paths in the drawing-local frame and translate both ordinary and split cut/lead paths once, without changing CNC programs. Add native Windows regressions using the operator's synthetic G90 fixture and incremental controls. Four absolute-mode cases fail before the fix; all seven pass after.
This commit is contained in:
1 parent
e7e4012974
commit
f4d5cfe98e
5 files changed
+172
-6
No files matched your search
@@ -20,10 +20,12 @@ namespace OpenNest
|
||||
|
||||
public static GraphicsPath GetGraphicsPath(this Program pgm, Vector origin)
|
||||
{
|
||||
var path = new GraphicsPath();
|
||||
var curpos = origin;
|
||||
|
||||
AddProgram(path, pgm, pgm.Mode, ref curpos);
|
||||
// Program coordinates are drawing-local in either mode. Translate the
|
||||
// finished path so absolute moves cannot discard the part placement.
|
||||
var path = pgm.GetGraphicsPath();
|
||||
using var translation = new Matrix();
|
||||
translation.Translate((float)origin.X, (float)origin.Y);
|
||||
path.Transform(translation);
|
||||
|
||||
return path;
|
||||
}
|
||||
@@ -100,9 +102,14 @@ namespace OpenNest
|
||||
{
|
||||
cutPath = new GraphicsPath();
|
||||
leadPath = new GraphicsPath();
|
||||
var curpos = origin;
|
||||
var curpos = Vector.Zero;
|
||||
|
||||
AddProgramSplit(cutPath, leadPath, pgm, pgm.Mode, ref curpos);
|
||||
|
||||
using var translation = new Matrix();
|
||||
translation.Translate((float)origin.X, (float)origin.Y);
|
||||
cutPath.Transform(translation);
|
||||
leadPath.Transform(translation);
|
||||
}
|
||||
|
||||
private static void AddProgramSplit(
|
||||
|
||||
Reference in new issue
Block a user