need to revisit adaptive plunge with contour

This commit is contained in:
Stewart Allen 2025-07-10 21:07:50 -04:00
commit 4bba10717a
3 changed files with 24 additions and 8 deletions

View file

@ -452,8 +452,7 @@ function cancelWorker() {
} }
function parseCode(code, type) { function parseCode(code, type) {
const { conf, event, show, widgets, view } = api; const { conf, event, show, stacks, widgets, view } = api;
const { stacks } = kiri;
const settings = conf.get(); const settings = conf.get();
event.emit("code.load", {code, type}); event.emit("code.load", {code, type});

View file

@ -613,10 +613,15 @@ class Print {
scope.belt = belt; scope.belt = belt;
if (scope.debugE) { if (scope.debugE) {
console.log({ bounds, print_time: time.round(2) }); console.log({
bounds,
minf,
maxf,
print_time: time.round(2),
output: scope.output
});
} }
console.log(scope.output)
done({ output: scope.output }); done({ output: scope.output });
} }
} }

View file

@ -177,6 +177,7 @@ export function prepEach(widget, settings, print, firstPoint, update) {
} }
feedRate = feed || feedRate || plunge; feedRate = feed || feedRate || plunge;
plungeRate = Math.min(feedRate || plunge, plunge || plungeRate || feedRate); plungeRate = Math.min(feedRate || plunge, plunge || plungeRate || feedRate);
console.log({ setTool: toolID, feed, plunge, plungeRate });
} }
function setLasering(bool, power = 0) { function setLasering(bool, power = 0) {
@ -461,16 +462,27 @@ export function prepEach(widget, settings, print, firstPoint, update) {
} }
// set new plunge rate // set new plunge rate
if (!lasering && deltaZ < -tolerance && !isLathe) { if (!lasering && !isLathe && deltaZ < -tolerance) {
let threshold = Math.min(deltaXY / 2, absDeltaZ), let threshold = Math.min(deltaXY / 2, absDeltaZ),
modifier = threshold / absDeltaZ; modifier = threshold / absDeltaZ;
if (synthPlunge && threshold && modifier && deltaXY > tolerance) { if (synthPlunge && threshold && modifier && deltaXY > tolerance) {
// use modifier to speed up long XY move plunge rates // use modifier to speed up long XY move plunge rates
// console.log('modifier', modifier); // console.log('modifier', modifier);
rate = Math.round(plungeRate + ((feedRate - plungeRate) * modifier)); rate = Math.max(
cut = 1; plungeRate,
Math.round(plungeRate + ((feedRate - plungeRate) * modifier))
);
} else { } else {
rate = 1 / Math.hypot(deltaXY / feedRate, absDeltaZ / plungeRate); let L = Math.hypot(deltaXY, absDeltaZ);
let limXY = feedRate * L / deltaXY;
let limZ = plungeRate * L / Math.abs(deltaZ);
rate = Math.min(feedRate, limXY, limZ);
// let zps = len / absDeltaZ;
// rate = Math.max(
// plungeRate,
// 1 / Math.hypot(deltaXY / feedRate, absDeltaZ / plungeRate)
// );
// console.log({ rate, deltaXY, deltaZ });
} }
} }