restrict trace output merge when down enabled

This commit is contained in:
Stewart Allen 2025-02-10 21:28:20 -05:00
commit 8a3be70bbb
2 changed files with 9 additions and 9 deletions

View file

@ -1517,7 +1517,7 @@ CAM.init = function(kiri, api) {
thru: UC.newInput(LANG.cc_thru_s, {title:LANG.cc_thru_l, convert:UC.toFloat, units:true}),
offover: UC.newInput(LANG.cc_offd_s, {title:LANG.cc_offd_l, convert:UC.toFloat, units:true, show:() => poppedRec.offset !== "none"}),
sep: UC.newBlank({class:"pop-sep", modes:MCAM, xshow:zDogSep}),
merge: UC.newBoolean(LANG.co_merg_s, undefined, {title:LANG.co_merg_l}),
merge: UC.newBoolean(LANG.co_merg_s, undefined, {title:LANG.co_merg_l, show:() => !popOp.trace.rec.down}),
dogbone: UC.newBoolean(LANG.co_dogb_s, undefined, {title:LANG.co_dogb_l, show:canDogBones}),
revbone: UC.newBoolean(LANG.co_dogr_s, undefined, {title:LANG.co_dogr_l, show:canDogBonesRev}),
exp: UC.newExpand("overrides"),

View file

@ -954,7 +954,7 @@ class OpTrace extends CamOp {
async slice(progress) {
let { op, state } = this;
let { tool, rate, down, plunge, offset, offover, thru } = op;
let { ov_topz, ov_botz, ov_conv } = op;
let { ov_conv } = op;
let { settings, widget, addSlices, zThru, tabs, workarea } = state;
let { updateToolDiams, cutTabs, cutPolys, healPolys, color } = state;
let { process, stock } = settings;
@ -976,6 +976,7 @@ class OpTrace extends CamOp {
let stockRect = stock.center && stock.x && stock.y ?
newPolygon().centerRectangle(stock.center, stock.x, stock.y) : undefined;
updateToolDiams(toolDiam);
if (tabs) {
tabs.forEach(tab => {
tab.off = POLY.expand([tab.poly], toolDiam / 2).flat();
@ -1137,12 +1138,11 @@ class OpTrace extends CamOp {
}
output.push(pi);
}
}
// merge overlapping output to prevent overcuts
if (op.merge) {
let nest = POLY.nest(output);
let union = POLY.union(nest, 0, true);
output = POLY.flatten(union, [], true);
if (!down && op.merge) {
let nest = POLY.nest(output);
let union = POLY.union(nest, 0, true);
output = POLY.flatten(union, [], true);
}
}
for (let poly of output) {
followZ(poly);
@ -1194,7 +1194,7 @@ class OpPocket extends CamOp {
const debug = false;
let { op, state } = this;
let { tool, rate, down, plunge, expand, contour, smooth, tolerance } = op;
let { ov_topz, ov_botz, ov_conv } = op;
let { ov_botz, ov_conv } = op;
let { settings, widget, addSlices, zBottom, zThru, tabs, color } = state;
let { updateToolDiams, cutTabs, healPolys, shadowAt, workarea } = state;
let { process } = settings;