Improve routing between areas for CAM area operations

This commit is contained in:
natekfl 2026-03-10 22:20:59 -04:00
commit c07419cf61

View file

@ -471,7 +471,8 @@ class OpArea extends CamOp {
while (areas?.length) { while (areas?.length) {
let min = { let min = {
dist: Infinity, dist: Infinity,
area: undefined area: undefined,
point: undefined
}; };
for (let area of areas.filter(p => !p.used)) { for (let area of areas.filter(p => !p.used)) {
@ -486,12 +487,14 @@ class OpArea extends CamOp {
if (find.distance < min.dist) { if (find.distance < min.dist) {
min.area = area; min.area = area;
min.dist = find.distance; min.dist = find.distance;
min.point = find.point
} }
} }
// if we have a next-closest top poly, pocket that // if we have a next-closest top poly, pocket that
if (min.area) { if (min.area) {
min.area.used = true; min.area.used = true;
printPoint = min.point;
pocket({ pocket({
cutdir: op.ov_conv, cutdir: op.ov_conv,
depthFirst: process.camDepthFirst, depthFirst: process.camDepthFirst,