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
|
|
@ -8,6 +8,7 @@ Full docs @ https://docs.grid.space/projects/kiri-moto
|
|||
* more graceful handling of security contexts blocking SharedArrayBuffer
|
||||
* FDM refactor the 'detect' support feature for auto-placing manual supports
|
||||
* FDM fix supports in belt mode
|
||||
* CAM fix issue #230 shared tool numbers cause animation errors
|
||||
* CAM fix surface / trace selection copy on hover/pop/new op
|
||||
* CAM decrease cutting speed when entire tool is engaged in roughing
|
||||
* CAM add dogbones support to traces ops
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -560,7 +560,6 @@ class OpOutline extends CamOp {
|
|||
if (op.top) {
|
||||
let first = slices[0];
|
||||
let zlist = slices.map(s => s.z);
|
||||
console.log({zlist});
|
||||
for (let z of indices.filter(v => v >= zMax).reverse()) {
|
||||
if (zlist.contains(z)) {
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ function prepEach(widget, settings, print, firstPoint, update) {
|
|||
null,
|
||||
0,
|
||||
time,
|
||||
tool.getNumber()
|
||||
tool
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -319,7 +319,7 @@ function prepEach(widget, settings, print, firstPoint, update) {
|
|||
if (!lastPoint) {
|
||||
let above = point.clone().setZ(stockz + zclear);
|
||||
// let above = point.clone().setZ(zmax + zadd + ztOff);
|
||||
lastPoint = layerPush(above, 0, 0, tool.getNumber());
|
||||
lastPoint = layerPush(above, 0, 0, tool);
|
||||
}
|
||||
|
||||
// measure deltas to last point in XY and Z
|
||||
|
|
@ -344,15 +344,15 @@ function prepEach(widget, settings, print, firstPoint, update) {
|
|||
isMove = false;
|
||||
} else if (deltaZ <= -tolerance) {
|
||||
// move over before descending
|
||||
layerPush(point.clone().setZ(lastPoint.z), 0, 0, tool.getNumber());
|
||||
layerPush(point.clone().setZ(lastPoint.z), 0, 0, tool);
|
||||
// new pos for plunge calc
|
||||
deltaXY = 0;
|
||||
}
|
||||
} else if (isMove && isLathe) {
|
||||
if (point.z > lastPoint.z) {
|
||||
layerPush(lastPoint.clone().setZ(point.z), 0, 0, tool.getNumber());
|
||||
layerPush(lastPoint.clone().setZ(point.z), 0, 0, tool);
|
||||
} else if (point.z < lastPoint.z) {
|
||||
layerPush(point.clone().setZ(lastPoint.z), 0, 0, tool.getNumber());
|
||||
layerPush(point.clone().setZ(lastPoint.z), 0, 0, tool);
|
||||
}
|
||||
} else if (isMove) {
|
||||
// for longer moves, check the terrain to see if we need to go up and over
|
||||
|
|
@ -384,9 +384,9 @@ function prepEach(widget, settings, print, firstPoint, update) {
|
|||
if (mustGoUp || zIsBelow) {
|
||||
const zClearance = clearz + (isIndexed ? 0 : ztOff);
|
||||
if (zIsBelow) {
|
||||
layerPush(lastPoint.clone().setZ(zClearance), 0, 0, tool.getNumber());
|
||||
layerPush(lastPoint.clone().setZ(zClearance), 0, 0, tool);
|
||||
}
|
||||
layerPush(point.clone().setZ(zClearance), 0, 0, tool.getNumber());
|
||||
layerPush(point.clone().setZ(zClearance), 0, 0, tool);
|
||||
// new pos for plunge calc
|
||||
deltaXY = 0;
|
||||
}
|
||||
|
|
@ -413,7 +413,7 @@ function prepEach(widget, settings, print, firstPoint, update) {
|
|||
point,
|
||||
cut ? 1 : 0,
|
||||
rate,
|
||||
tool.getNumber()
|
||||
tool
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -476,7 +476,7 @@ function prepEach(widget, settings, print, firstPoint, update) {
|
|||
update((opSum + (progress * weight)) / opTot, message || op.type(), message);
|
||||
});
|
||||
opSum += weight;
|
||||
if (tool) {
|
||||
if (tool && lastPoint) {
|
||||
newLayer();
|
||||
camOut(printPoint = lastPoint.clone().setZ(zmax + zadd));
|
||||
newLayer();
|
||||
|
|
@ -593,7 +593,7 @@ function prepEach(widget, settings, print, firstPoint, update) {
|
|||
if (lastPoint && newOutput.length) {
|
||||
let lastLayer = newOutput.filter(layer => Array.isArray(layer)).peek();
|
||||
if (Array.isArray(lastLayer)) {
|
||||
print.addOutput(lastLayer, printPoint = lastPoint.clone().setZ(zmax_outer), 0, 0, tool.getNumber());
|
||||
print.addOutput(lastLayer, printPoint = lastPoint.clone().setZ(zmax_outer), 0, 0, tool);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue