remove dead code, add comments
This commit is contained in:
parent
521dfa058e
commit
cedb40b5fc
1 changed files with 29 additions and 79 deletions
|
|
@ -779,6 +779,9 @@
|
||||||
let tops = slice.shadow.clone(true);
|
let tops = slice.shadow.clone(true);
|
||||||
let offset = POLY.expand(tops, diameter / 2, slice.z);
|
let offset = POLY.expand(tops, diameter / 2, slice.z);
|
||||||
|
|
||||||
|
if (!inside)
|
||||||
|
POLY.offset(shell, diameter/2, { outs: offset, flat: true, z: slice.z });
|
||||||
|
|
||||||
// when pocket only, drop first outer poly
|
// when pocket only, drop first outer poly
|
||||||
// if it matches the shell and promote inner polys
|
// if it matches the shell and promote inner polys
|
||||||
if (inside) {
|
if (inside) {
|
||||||
|
|
@ -801,9 +804,7 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const output = POLY.flatten(offset, [], true);
|
slice.tops[0].traces = offset;
|
||||||
|
|
||||||
slice.tops[0].traces = output;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -950,78 +951,33 @@
|
||||||
slice.tops[0].traces = nutrace;
|
slice.tops[0].traces = nutrace;
|
||||||
}
|
}
|
||||||
|
|
||||||
// called when z-index slicing complete
|
// TODO cache terrain slicer info in widget
|
||||||
const camSlicesDone = function(slices) {
|
// TODO pass widget.isModified() on slice and re-use if false
|
||||||
|
// TODO pre-slice in background from client signal
|
||||||
// return outermost (bottom layer) "top" polys
|
// TODO same applies to topo map generation
|
||||||
// const camShell = pancake(slices, function(update) {
|
|
||||||
// onupdate(0.25 + update * 0.15, "shelling");
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// // set all default shells
|
|
||||||
// const camShellPolys = shellOutline = facePolys = camShell.gatherTopPolys([]);
|
|
||||||
|
|
||||||
if (procDrillReg) {
|
|
||||||
sliceDrillReg(settings, widget, sliceAll, zThru);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (procDrill) {
|
|
||||||
sliceDrill(settings, widget, slices, sliceAll);
|
|
||||||
}
|
|
||||||
|
|
||||||
// if (procOutline) {
|
|
||||||
// if (!procOutlineOn) {
|
|
||||||
// // expand shell minimally triggering a clean
|
|
||||||
// shellOutline = POLY.expand(shellOutline, -outlineToolDiam / 2, 0);
|
|
||||||
// } else {
|
|
||||||
// // expand shell by half tool diameter (not needed because only one offset)
|
|
||||||
// // shellOutline = POLY.expand(shellOutline, outlineToolDiam / 2, 0);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// clear area from top of stock to top of part
|
|
||||||
// if (procFacing) {
|
|
||||||
// let ztop = bounds.max.z,
|
|
||||||
// zpos = ztop + ztoff,
|
|
||||||
// zstep = camRoughDown;
|
|
||||||
//
|
|
||||||
// while (zpos >= ztop) {
|
|
||||||
// zpos = zpos - Math.min(zstep, zpos - ztop);
|
|
||||||
//
|
|
||||||
// const slice = newSlice(zpos, mesh.newGroup ? mesh.newGroup() : null);
|
|
||||||
// slice.camMode = CPRO.LEVEL;
|
|
||||||
// sliceAll.append(slice);
|
|
||||||
//
|
|
||||||
// shellRough.clone().forEach(function(poly) {
|
|
||||||
// slice.addTop(poly);
|
|
||||||
// })
|
|
||||||
//
|
|
||||||
// if (Math.abs(zpos - ztop) < 0.001) break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (procOutline) {
|
|
||||||
// let selected = [];
|
|
||||||
// selectSlices(slices, proc.camOutlineDown * units, CPRO.OUTLINE, selected);
|
|
||||||
// if (zThru) {
|
|
||||||
// addZThru(selected);
|
|
||||||
// }
|
|
||||||
// sliceAll.appendAll(selected);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
let slicer = new KIRI.slicer2(widget.getPoints(), {
|
let slicer = new KIRI.slicer2(widget.getPoints(), {
|
||||||
zlist: true,
|
zlist: true,
|
||||||
zline: true
|
zline: true
|
||||||
});
|
});
|
||||||
|
let tslices = [];
|
||||||
let tshadow = [];
|
let tshadow = [];
|
||||||
let tzindex = slicer.interval(1); // bottom up
|
let tzindex = slicer.interval(1); // bottom up 1mm steps
|
||||||
let terrain = slicer.slice(tzindex, { each: (data, index, total) => {
|
let terrain = slicer.slice(tzindex, { each: (data, index, total) => {
|
||||||
console.log('terrain', index, total, data);
|
console.log('terrain', index, total, data);
|
||||||
tshadow = POLY.union(tshadow.appendAll(data.tops), 0.01, true);
|
tshadow = POLY.union(tshadow.appendAll(data.tops), 0.01, true);
|
||||||
} });
|
tslices.push(data.slice);
|
||||||
|
onupdate(0.0 + (index/total) * 0.1, "mapping");
|
||||||
|
}, genso: true });
|
||||||
console.log({slicer, tzindex, tshadow, terrain});
|
console.log({slicer, tzindex, tshadow, terrain});
|
||||||
|
|
||||||
|
if (procDrillReg) {
|
||||||
|
sliceDrillReg(settings, widget, sliceAll, zThru);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (procDrill) {
|
||||||
|
sliceDrill(settings, widget, tslices, sliceAll);
|
||||||
|
}
|
||||||
|
|
||||||
// creating roughing slices
|
// creating roughing slices
|
||||||
if (procRough) {
|
if (procRough) {
|
||||||
// identify through holes
|
// identify through holes
|
||||||
|
|
@ -1035,6 +991,7 @@
|
||||||
data.slice.camMode = CPRO.ROUGH;
|
data.slice.camMode = CPRO.ROUGH;
|
||||||
data.slice.shadow = data.shadow;
|
data.slice.shadow = data.shadow;
|
||||||
slices.push(data.slice);
|
slices.push(data.slice);
|
||||||
|
onupdate(0.1 + (index/total) * 0.1, "roughing");
|
||||||
}, genso: true });
|
}, genso: true });
|
||||||
|
|
||||||
// inset or eliminate thru holes from shadow
|
// inset or eliminate thru holes from shadow
|
||||||
|
|
@ -1071,6 +1028,7 @@
|
||||||
data.slice.camMode = CPRO.OUTLINE;
|
data.slice.camMode = CPRO.OUTLINE;
|
||||||
data.slice.shadow = data.shadow;
|
data.slice.shadow = data.shadow;
|
||||||
slices.push(data.slice);
|
slices.push(data.slice);
|
||||||
|
onupdate(0.2 + (index/total) * 0.1, "roughing");
|
||||||
}, genso: true });
|
}, genso: true });
|
||||||
|
|
||||||
shellOutline = tshadow;
|
shellOutline = tshadow;
|
||||||
|
|
@ -1091,23 +1049,15 @@
|
||||||
sliceAll.appendAll(slices);
|
sliceAll.appendAll(slices);
|
||||||
}
|
}
|
||||||
|
|
||||||
// horizontal slices for rough/outline
|
|
||||||
doSlicing(widget, {height:sliceDepth, cam:true, zmin:zBottom, noEmpty:true}, camSlicesDone, function(update) {
|
|
||||||
onupdate(0.0 + update * 0.25, "slicing");
|
|
||||||
});
|
|
||||||
|
|
||||||
// we need topo for safe travel moves when roughing and outlining
|
// we need topo for safe travel moves when roughing and outlining
|
||||||
// not generated when drilling-only. then all z moves use bounds max.
|
// not generated when drilling-only. then all z moves use bounds max.
|
||||||
// also generates x and y contouring when selected
|
// also generates x and y contouring when selected
|
||||||
// if (procRough || procOutline || procContour)
|
if (procContour)
|
||||||
// generateTopoMap(widget, settings, function(slices) {
|
generateTopoMap(widget, settings, function(slices) {
|
||||||
// sliceAll.appendAll(slices);
|
sliceAll.appendAll(slices);
|
||||||
// // todo union rough / outline shells
|
}, function(update, msg) {
|
||||||
// // todo union rough / outline tabs
|
onupdate(0.40 + update * 0.50, msg || "create topo");
|
||||||
// // todo append to generated topo map
|
});
|
||||||
// }, function(update, msg) {
|
|
||||||
// onupdate(0.40 + update * 0.50, msg || "create topo");
|
|
||||||
// });
|
|
||||||
|
|
||||||
// prepare for tracing paths
|
// prepare for tracing paths
|
||||||
let traceTool;
|
let traceTool;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue