allow newSlice to track a specified widget to aid 4th axis visuals
This commit is contained in:
parent
5a726c49c8
commit
f588e2e5cf
5 changed files with 33 additions and 14 deletions
|
|
@ -471,7 +471,6 @@ class OpOutline extends CamOp {
|
|||
if (op.down <= 0) {
|
||||
throw `invalid step down "${op.down}"`;
|
||||
}
|
||||
|
||||
let toolDiam = this.toolDiam = new CAM.Tool(settings, op.tool).fluteDiameter();
|
||||
updateToolDiams(toolDiam);
|
||||
|
||||
|
|
@ -622,6 +621,9 @@ class OpOutline extends CamOp {
|
|||
slice.camLines = offset;
|
||||
});
|
||||
|
||||
// when top expand fails above, it creates an empty slice
|
||||
slices = slices.filter(s => s.camLines);
|
||||
|
||||
// project empty up and render
|
||||
for (let slice of slices) {
|
||||
if (false) slice.output()
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
gapp.register("kiri-mode.cam.slice", [], (root, exports) => {
|
||||
|
||||
const { base, kiri } = root;
|
||||
const { driver, newSlice } = kiri;
|
||||
const { driver, newSlice, trackWidget } = kiri;
|
||||
const { polygons, newPoint, newPolygon } = base;
|
||||
const { CAM } = driver;
|
||||
const { OPS } = CAM;
|
||||
|
|
@ -149,7 +149,7 @@ CAM.slice = function(settings, widget, onupdate, ondone) {
|
|||
sliceAll.appendAll(slices);
|
||||
if (axisIndex !== undefined) {
|
||||
// update slice cam lines to add axis indexing
|
||||
for (let slice of slices) {
|
||||
for (let slice of slices.filter(s => s.camLines)) {
|
||||
for (let poly of slice.camLines) {
|
||||
for (let point of poly.points) {
|
||||
point.a = -axisIndex;
|
||||
|
|
@ -208,6 +208,7 @@ CAM.slice = function(settings, widget, onupdate, ondone) {
|
|||
state.ops = opList;
|
||||
|
||||
// call slice() function on all ops in order
|
||||
trackWidget(widget);
|
||||
setAxisIndex(undefined);
|
||||
for (let op of opList) {
|
||||
let weight = op.weight();
|
||||
|
|
@ -215,7 +216,7 @@ CAM.slice = function(settings, widget, onupdate, ondone) {
|
|||
onupdate((opSum + (progress * weight)) / opTot, message || op.type());
|
||||
});
|
||||
// setup new state when indexing the workspace
|
||||
if (false && op.op.type === "index") {
|
||||
if (true && op.op.type === "index") {
|
||||
let points = base.verticesToPoints(widget.getGeoVertices(true, true));
|
||||
state.slicer = new kiri.cam_slicer(points, {
|
||||
zlist: true,
|
||||
|
|
@ -223,12 +224,13 @@ CAM.slice = function(settings, widget, onupdate, ondone) {
|
|||
nobucket: true // b/c negative Z when rotated
|
||||
});
|
||||
new CAM.OPS.shadow(state, { type: "shadow", silent: true }).slice(progress => {
|
||||
console.log('reshadow', progress.round(3));
|
||||
// console.log('reshadow', progress.round(3));
|
||||
});
|
||||
}
|
||||
camOps.push(op);
|
||||
opSum += weight;
|
||||
}
|
||||
trackWidget(undefined);
|
||||
|
||||
// reindex
|
||||
sliceAll.forEach((slice, index) => slice.index = index);
|
||||
|
|
|
|||
Loading…
Reference in a new issue