fixes for indexed rotations
This commit is contained in:
parent
052716ec6d
commit
32b5248fda
4 changed files with 25 additions and 9 deletions
|
|
@ -56,8 +56,8 @@ class Print {
|
|||
// drop duplicates (usually intruced by FDM bisections)
|
||||
if (lastPoint && point && !arc && type !== 'lerp') {
|
||||
// nested due to uglify confusing browser
|
||||
const { x, y, z } = lastPoint;
|
||||
if (point.x == x && point.y == y && point.z == z && lastEmit == emit) {
|
||||
const { x, y, z, a } = lastPoint;
|
||||
if (point.x == x && point.y == y && point.z == z && point.a == z && lastEmit == emit) {
|
||||
return lastOut;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -169,6 +169,7 @@ export function cam_export(print, online) {
|
|||
function moveTo(out, opt = {}) {
|
||||
let laser = out.type === 'laser';
|
||||
let newpos = out.point;
|
||||
console.log(mode.type, out.point);
|
||||
|
||||
// no point == dwell
|
||||
// out.speed = time to dwell in ms
|
||||
|
|
@ -425,7 +426,9 @@ export function cam_export(print, online) {
|
|||
toolz[out.tool] = ctool;
|
||||
}
|
||||
point = out.point;
|
||||
if (!point || point.mod) return;
|
||||
if (!point || point.mod) {
|
||||
return;
|
||||
}
|
||||
// ensure not point is modified twice
|
||||
point.mod = 1;
|
||||
if (isOffset) {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ export class OpIndex extends CamOp {
|
|||
}
|
||||
|
||||
prepare(ops, progress) {
|
||||
const { lastPoint, zmax, zclear, camOut, stock } = ops;
|
||||
const { lastPoint, zmax, zclear, camOut, stock, newLayer } = ops;
|
||||
let last = lastPoint();
|
||||
if (last) {
|
||||
// max point of stock corner radius when rotating (safe z when indexing)
|
||||
|
|
@ -34,7 +34,7 @@ export class OpIndex extends CamOp {
|
|||
// move above rotating stock
|
||||
camOut(last = last.clone().setZ(zmove), 0);
|
||||
// issue rotation command
|
||||
camOut(last = last.clone().setY(0).setA(this.degrees), 0);
|
||||
camOut(last = last.clone().setZ(zmove).setA(this.degrees), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ export function prepEach(widget, settings, print, firstPoint, update) {
|
|||
toolDiamMove,
|
||||
plungeRate = process.camFastFeedZ,
|
||||
feedRate,
|
||||
lastOp,
|
||||
lastTool,
|
||||
lastPush,
|
||||
lastPoint,
|
||||
|
|
@ -268,6 +269,7 @@ export function prepEach(widget, settings, print, firstPoint, update) {
|
|||
if (dz < 0 && speed > plungeRate) {
|
||||
speed = plungeRate;
|
||||
}
|
||||
// if (options?.type !== 'lerp') console.log( point, currentOp.type );
|
||||
layerOut.mode = currentOp;
|
||||
if (lasering) {
|
||||
let power = emit ? laserPower : 0;
|
||||
|
|
@ -333,7 +335,13 @@ export function prepEach(widget, settings, print, firstPoint, update) {
|
|||
* @param {number} opts.factor speed scale factor
|
||||
*/
|
||||
function camOut(point, emit = 1, opts) {
|
||||
// console.trace({point, emit, opts})
|
||||
let lop = lastOp;
|
||||
lastOp = currentOp;
|
||||
if (lop?.type === 'index' && lop !== currentOp ) {
|
||||
// console.log('post index first point', point);
|
||||
camOut(point.clone().setZ(lastPoint.z).setA(lastPoint.a), 1);
|
||||
}
|
||||
|
||||
let {
|
||||
center = {},
|
||||
clockwise = true,
|
||||
|
|
@ -370,7 +378,7 @@ export function prepEach(widget, settings, print, firstPoint, update) {
|
|||
for (let a of lerp) {
|
||||
let lp = point.clone().setA(a);
|
||||
// console.log(lp.a, lp.x, lp.y, lp.z);
|
||||
lastPoint = layerPush(
|
||||
layerPush(
|
||||
lp,
|
||||
emit,
|
||||
rate,
|
||||
|
|
@ -403,10 +411,11 @@ export function prepEach(widget, settings, print, firstPoint, update) {
|
|||
layerPush(point.clone().setZ(stockz + 1), 0, 0, tool);
|
||||
// change to cutting move for remainder of plunge
|
||||
emit = 1;
|
||||
isMove = false;
|
||||
}
|
||||
|
||||
// drop points too close together
|
||||
if (!isLathe && !isArc && deltaXY < 0.001 && point.z === lastPoint.z) {
|
||||
if (!isLathe && !isArc && deltaXY < 0.001 && point.z === lastPoint.z && point.a === lastPoint.a) {
|
||||
// console.trace(["drop dup",lastPoint,point]);
|
||||
return;
|
||||
}
|
||||
|
|
@ -420,6 +429,7 @@ export function prepEach(widget, settings, print, firstPoint, update) {
|
|||
emit = 1;
|
||||
isMove = false;
|
||||
} else if (deltaZ <= -tolerance) {
|
||||
console.log({ deltaZ, tolerance });
|
||||
// move over before descending
|
||||
layerPush(point.clone().setZ(lastPoint.z), 0, 0, tool);
|
||||
// new pos for plunge calc
|
||||
|
|
@ -1096,7 +1106,10 @@ export 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);
|
||||
printPoint = lastPoint.clone();
|
||||
if (printPoint.z < zmax_outer) printPoint.setZ(zmax_outer);
|
||||
print.addOutput(lastLayer, printPoint, 0, 0, tool);
|
||||
// print.addOutput(lastLayer, printPoint = lastPoint.clone().setZ(zmax_outer), 0, 0, tool);
|
||||
}
|
||||
}
|
||||
// console.log("prepare output", newOutput);
|
||||
|
|
|
|||
Loading…
Reference in a new issue