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) {
const { conf, event, show, widgets, view } = api;
const { stacks } = kiri;
const { conf, event, show, stacks, widgets, view } = api;
const settings = conf.get();
event.emit("code.load", {code, type});

View file

@ -613,10 +613,15 @@ class Print {
scope.belt = belt;
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 });
}
}

View file

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