fix z clear and ordering on index command
This commit is contained in:
parent
a46ee6e402
commit
bf2bd6cdfd
5 changed files with 25 additions and 10 deletions
|
|
@ -45,6 +45,16 @@ class Point {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setX(x) {
|
||||||
|
this.x = x;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
setY(y) {
|
||||||
|
this.y = y;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
setZ(z) {
|
setZ(z) {
|
||||||
this.z = z;
|
this.z = z;
|
||||||
return this;
|
return this;
|
||||||
|
|
|
||||||
|
|
@ -515,7 +515,7 @@ CAM.init = function(kiri, api) {
|
||||||
let inside = true;
|
let inside = true;
|
||||||
let popped = false;
|
let popped = false;
|
||||||
let poprec = popOp[rec.type];
|
let poprec = popOp[rec.type];
|
||||||
if (type === 'index' & indexing && !rec.disabled) {
|
if (type === 'index' && indexing && !rec.disabled) {
|
||||||
index = rec.absolute ? rec.degrees : index + rec.degrees;
|
index = rec.absolute ? rec.degrees : index + rec.degrees;
|
||||||
}
|
}
|
||||||
el.rec = rec;
|
el.rec = rec;
|
||||||
|
|
@ -819,9 +819,9 @@ CAM.init = function(kiri, api) {
|
||||||
iw = int.object.widget;
|
iw = int.object.widget;
|
||||||
ic = int.point;
|
ic = int.point;
|
||||||
// only near vertical faces
|
// only near vertical faces
|
||||||
if (Math.abs(n.z) > 0.3) {
|
// if (Math.abs(n.z) > 0.3) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
showTab = createTabBox(iw, ic, n);
|
showTab = createTabBox(iw, ic, n);
|
||||||
};
|
};
|
||||||
func.tabHoverUp = function(int) {
|
func.tabHoverUp = function(int) {
|
||||||
|
|
|
||||||
|
|
@ -49,17 +49,20 @@ class OpIndex extends CamOp {
|
||||||
if (!state.isIndexed) {
|
if (!state.isIndexed) {
|
||||||
throw 'index op requires indexed stock';
|
throw 'index op requires indexed stock';
|
||||||
}
|
}
|
||||||
state.setAxisIndex(op.degrees, op.absolute);
|
this.degrees = state.setAxisIndex(op.degrees, op.absolute);
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare(ops, progress) {
|
prepare(ops, progress) {
|
||||||
const { lastPoint, zmax, camOut, stock } = ops;
|
const { lastPoint, zmax, zclear, camOut, stock } = ops;
|
||||||
// max point of stock corner radius when rotating (safe z when indexing)
|
let last = lastPoint();
|
||||||
const last = lastPoint();
|
|
||||||
if (last) {
|
if (last) {
|
||||||
const rzmax = (Math.max(stock.y, stock.z) * Math.sqrt(2)) / 2;
|
// max point of stock corner radius when rotating (safe z when indexing)
|
||||||
|
const rzmax = (Math.max(stock.y, stock.z) * Math.sqrt(2)) / 2 + zclear;
|
||||||
const zmove = Math.max(rzmax, zmax);
|
const zmove = Math.max(rzmax, zmax);
|
||||||
camOut(last.clone().setZ(zmove), 0);
|
// move above rotating stock
|
||||||
|
camOut(last = last.clone().setZ(zmove), 0);
|
||||||
|
// issue rotation command
|
||||||
|
camOut(last = last.clone().setY(0).setA(this.degrees), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -453,6 +453,7 @@ function prepEach(widget, settings, print, firstPoint, update) {
|
||||||
emitDrills,
|
emitDrills,
|
||||||
emitTrace,
|
emitTrace,
|
||||||
bounds,
|
bounds,
|
||||||
|
zclear,
|
||||||
zmax,
|
zmax,
|
||||||
lastPoint: () => { return lastPoint }
|
lastPoint: () => { return lastPoint }
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -146,6 +146,7 @@ CAM.slice = async function(settings, widget, onupdate, ondone) {
|
||||||
axisIndex = absolute ? degrees : axisIndex + degrees;
|
axisIndex = absolute ? degrees : axisIndex + degrees;
|
||||||
axisRotation = (Math.PI / 180) * axisIndex;
|
axisRotation = (Math.PI / 180) * axisIndex;
|
||||||
widget.setAxisIndex(isIndexed ? -axisIndex : 0);
|
widget.setAxisIndex(isIndexed ? -axisIndex : 0);
|
||||||
|
return isIndexed ? -axisIndex : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function addPolyIndexing(poly, a) {
|
function addPolyIndexing(poly, a) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue