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,27 +1427,33 @@ 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) {
printPoint = tip2tipEmit(depthData.linearx, printPoint, function(el, point, count) { // force start at lower left corner
let poly = el.poly; // printPoint = newPoint(bounds.min.x,bounds.min.y,zmax);
if (poly.last() === point) poly.reverse(); printPoint = tip2tipEmit(depthData.linearx, printPoint, function(el, point, count) {
poly.forEachPoint(function(point, pidx) { let poly = el.poly;
camOut(point.clone(), pidx > 0); if (poly.last() === point) poly.reverse();
}, false); poly.forEachPoint(function(point, pidx) {
newLayer(); camOut(point.clone(), pidx > 0);
return lastPoint; }, false);
}); newLayer();
return lastPoint;
});
}
// deferred linear y finishing // deferred linear y finishing
if (depthData.lineary.length > 0) if (depthData.lineary.length > 0) {
printPoint = tip2tipEmit(depthData.lineary, printPoint, function(el, point, count) { // force start at lower left corner
let poly = el.poly; // printPoint = newPoint(bounds.min.x,bounds.min.y,zmax);
if (poly.last() === point) poly.reverse(); printPoint = tip2tipEmit(depthData.lineary, printPoint, function(el, point, count) {
poly.forEachPoint(function(point, pidx) { let poly = el.poly;
camOut(point.clone(), pidx > 0); if (poly.last() === point) poly.reverse();
}, false); poly.forEachPoint(function(point, pidx) {
newLayer(); camOut(point.clone(), pidx > 0);
return lastPoint; }, false);
}); newLayer();
return lastPoint;
});
}
} }
} }

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;