fixes #230 shared tool numbers cause animation errors
This commit is contained in:
parent
c025d69a0a
commit
fec2fcc18d
5 changed files with 19 additions and 31 deletions
|
|
@ -151,20 +151,6 @@ CAM.export = function(print, online) {
|
|||
}
|
||||
}
|
||||
|
||||
function toolByNumber(number) {
|
||||
for (let i=0; i<tools.length; i++) {
|
||||
if (tools[i].number === number) return tools[i];
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function toolNameByNumber(number) {
|
||||
for (let i=0; i<tools.length; i++) {
|
||||
if (tools[i].number === number) return tools[i].name;
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
function moveTo(out, opt = {}) {
|
||||
let laser = out.type === 'laser';
|
||||
let newpos = out.point;
|
||||
|
|
@ -188,8 +174,8 @@ CAM.export = function(print, online) {
|
|||
let changeTool = out.tool != pos.t;
|
||||
if (changeTool) {
|
||||
pos.t = out.tool;
|
||||
consts.tool = pos.t;
|
||||
consts.tool_name = toolNameByNumber(out.tool);
|
||||
consts.tool = pos.t.getNumber();
|
||||
consts.tool_name = pos.t.getName();
|
||||
if (!laserOp && (spro.camToolInit || toolChanges > 0)) {
|
||||
filterEmit(cmdToolChange, { ...consts, spindle: newSpindle } );
|
||||
}
|
||||
|
|
@ -395,7 +381,7 @@ CAM.export = function(print, online) {
|
|||
return;
|
||||
}
|
||||
if (out.tool && out.tool !== ctool) {
|
||||
ctool = toolByNumber(out.tool);
|
||||
ctool = out.tool;
|
||||
toolz[out.tool] = ctool;
|
||||
}
|
||||
point = out.point;
|
||||
|
|
|
|||
Loading…
Reference in a new issue