fix non-depth-first finishing and tip2tip emit

This commit is contained in:
Stewart Allen 2020-03-11 13:19:29 -04:00
commit cd56cdd07d
2 changed files with 31 additions and 22 deletions

View file

@ -1323,6 +1323,10 @@ let gs_kiri_cam = exports;
break; break;
case modes.FINISH_X: case modes.FINISH_X:
case modes.FINISH_Y: case modes.FINISH_Y:
if (isNewMode || !printPoint) {
// force start at lower left corner
printPoint = newPoint(bounds.min.x,bounds.min.y,zmax);
}
setTool(process.finishingTool, process.finishingSpeed, process.finishingPlunge); setTool(process.finishingTool, process.finishingSpeed, process.finishingPlunge);
spindle = Math.min(spindleMax, process.finishingSpindle); spindle = Math.min(spindleMax, process.finishingSpindle);
depthData.finishDiam = toolDiam; depthData.finishDiam = toolDiam;
@ -1343,9 +1347,9 @@ let gs_kiri_cam = exports;
poly.forEachPoint(function(point, pidx) { poly.forEachPoint(function(point, pidx) {
camOut(point.clone(), pidx > 0); camOut(point.clone(), pidx > 0);
}, false); }, false);
return lastPoint;
}); });
newLayer(); newLayer();
return lastPoint;
} }
}); });
break; break;
@ -1423,7 +1427,9 @@ let gs_kiri_cam = exports;
setTool(process.finishingTool, process.finishingSpeed, process.finishingPlunge); setTool(process.finishingTool, process.finishingSpeed, process.finishingPlunge);
spindle = Math.min(spindleMax, process.finishingSpindle); spindle = Math.min(spindleMax, process.finishingSpindle);
// deferred linear x finishing // deferred linear x finishing
if (depthData.linearx.length > 0) if (depthData.linearx.length > 0) {
// force start at lower left corner
// printPoint = newPoint(bounds.min.x,bounds.min.y,zmax);
printPoint = tip2tipEmit(depthData.linearx, printPoint, function(el, point, count) { printPoint = tip2tipEmit(depthData.linearx, printPoint, function(el, point, count) {
let poly = el.poly; let poly = el.poly;
if (poly.last() === point) poly.reverse(); if (poly.last() === point) poly.reverse();
@ -1433,8 +1439,11 @@ let gs_kiri_cam = exports;
newLayer(); newLayer();
return lastPoint; return lastPoint;
}); });
}
// deferred linear y finishing // deferred linear y finishing
if (depthData.lineary.length > 0) if (depthData.lineary.length > 0) {
// force start at lower left corner
// printPoint = newPoint(bounds.min.x,bounds.min.y,zmax);
printPoint = tip2tipEmit(depthData.lineary, printPoint, function(el, point, count) { printPoint = tip2tipEmit(depthData.lineary, printPoint, function(el, point, count) {
let poly = el.poly; let poly = el.poly;
if (poly.last() === point) poly.reverse(); if (poly.last() === point) poly.reverse();
@ -1446,6 +1455,7 @@ let gs_kiri_cam = exports;
}); });
} }
} }
}
// drilling is always depth first // drilling is always depth first
if (depthData.drill.length > 0) { if (depthData.drill.length > 0) {

View file

@ -854,7 +854,6 @@ var gs_kiri_print = exports;
*/ */
function tip2tipEmit(array, startPoint, emitter) { function tip2tipEmit(array, startPoint, emitter) {
var mindist, dist, found, count = 0; var mindist, dist, found, count = 0;
for (;;) { for (;;) {
found = null; found = null;
mindist = Infinity; mindist = Infinity;