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