fixes #230 shared tool numbers cause animation errors

This commit is contained in:
Stewart Allen 2023-03-17 14:56:29 -04:00
commit fec2fcc18d
5 changed files with 19 additions and 31 deletions

View file

@ -425,7 +425,9 @@ kiri.load(() => {
}
pathIndex++;
if (next.tool >= 0 && (!tool || tool.getNumber() !== next.tool)) {
const firstTool = !tool && next.tool;
const toolChange = !firstTool && (tool.getID() !== next.tool.getID());
if (firstTool || toolChange) {
// on real tool change, go to safe Z first
if (tool && last.point) {
let pos = last.point = {
@ -533,11 +535,11 @@ kiri.load(() => {
}
}
function updateTool(toolnum, send) {
function updateTool(toolobj, send) {
if (tool) {
send.data({ mesh_del: toolID });
}
tool = new CAM.Tool({ tools }, undefined, toolnum);
tool = new CAM.Tool({ tools }, toolobj.getID());
tool.generateProfile(rez);
const flen = tool.fluteLength() || 15;
const slen = tool.shaftLength() || 15;