From 7be206581d8f84a3bdc49a134db1f841206b442a Mon Sep 17 00:00:00 2001 From: hyper Date: Sun, 15 Mar 2026 21:08:41 +0800 Subject: [PATCH] refactor: plotter code --- src/plotcutter/plotter.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plotcutter/plotter.ts b/src/plotcutter/plotter.ts index 809f56d..413326a 100644 --- a/src/plotcutter/plotter.ts +++ b/src/plotcutter/plotter.ts @@ -29,6 +29,7 @@ export function pts2plotter( if (sorted.length > 0) { const firstPath = sorted[0]; str += ` U${plu(start[0] * px2mm)},${plu((height - start[1]) * px2mm)}`; + str += ` U${plu(firstPath[0][0] * px2mm)},${plu((height - firstPath[0][1]) * px2mm)}`; str += ` D${plu(firstPath[0][0] * px2mm)},${plu((height - firstPath[0][1]) * px2mm)}`; // 切割第一个路径 @@ -66,6 +67,8 @@ export function pts2plotter( // 返回终点 str += ` U${plu(end[0] * px2mm)},${plu((height - end[1]) * px2mm)}`; + str += ` D${plu(end[0] * px2mm)},${plu((height - end[1]) * px2mm)}`; + str += ` U${plu(end[0] * px2mm)},${plu((height - end[1]) * px2mm)}`; str += endCommand(); return str;