add roughing option to clear all stock to aid lathe mode

This commit is contained in:
Stewart Allen 2023-02-14 11:23:23 -05:00
commit 8580307661
6 changed files with 17 additions and 2 deletions

View file

@ -1212,6 +1212,10 @@ CAM.init = function(kiri, api) {
SPACE.update();
}
function hasIndexing() {
return isIndexed;
}
function hasSpindle() {
return current.device.spindleMax > 0;
}
@ -1245,6 +1249,7 @@ CAM.init = function(kiri, api) {
rate: 'camRoughSpeed',
plunge: 'camRoughPlunge',
leave: 'camRoughStock',
all: 'camRoughAll',
voids: 'camRoughVoid',
flats: 'camRoughFlat',
inside: 'camRoughIn',
@ -1260,6 +1265,7 @@ CAM.init = function(kiri, api) {
step: UC.newInput(LANG.cc_sovr_s, {title:LANG.cc_sovr_l, convert:UC.toFloat, bound:UC.bound(0.01,1.0)}),
leave: UC.newInput(LANG.cr_lsto_s, {title:LANG.cr_lsto_l, convert:UC.toFloat, units:true}),
sep: UC.newBlank({class:"pop-sep"}),
all: UC.newBoolean(LANG.cr_clst_s, undefined, {title:LANG.cr_clst_l, show:hasIndexing}),
voids: UC.newBoolean(LANG.cr_clrp_s, undefined, {title:LANG.cr_clrp_l}),
flats: UC.newBoolean(LANG.cr_clrf_s, undefined, {title:LANG.cr_clrf_l}),
top: UC.newBoolean(LANG.cr_clrt_s, undefined, {title:LANG.cr_clrt_l}),

View file

@ -180,6 +180,7 @@ class OpRough extends CamOp {
let roughTop = op.top;
let roughDown = op.down;
let roughLeave = op.leave;
let roughStock = op.all && state.isIndexed;
let toolDiam = new CAM.Tool(settings, op.tool).fluteDiameter();
let trueShadow = process.camTrueShadow === true;
@ -306,7 +307,9 @@ class OpRough extends CamOp {
// shell = shadow expanded by half tool diameter + leave stock
const sadd = roughIn ? toolDiam / 2 : toolDiam / 2;
const shell = POLY.offset(shadow, sadd + roughLeave);
const shell = roughStock ?
[ newPolygon().centerRectangle(stock.center, stock.x, stock.y) ] :
POLY.offset(shadow, sadd + roughLeave);
slices.forEach((slice, index) => {
let offset = [shell.clone(true),slice.shadow.clone(true)].flat();

View file

@ -107,13 +107,15 @@ class Topo4 {
range.min -= this.diam / 2;
range.max += this.diam / 2;
// merge in tab vertices (so they don't affect slice range / dimensions)
// merge in tab vertices here so they don't affect slice range / dimensions
for (let i=0, l=tabverts.length; i<l; i += 3) {
const x = tabverts[i];
const z = tabverts[i + 2];
tabverts[i] = z;
tabverts[i + 2] = x;
}
// re-create shared vertex array for workers
this.vertices = [].appendAll(vertices).appendAll(tabverts).toFloat32().toShared();
const shards = Math.ceil(Math.min(25, vertices.length / 27000));