feat: pocket contour now has expansion control and defaults to edges of selected regions

This commit is contained in:
Stewart Allen 2024-05-13 13:26:08 -04:00
commit 793d5f8089
2 changed files with 4 additions and 3 deletions

View file

@ -1466,7 +1466,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)}),
down: UC.newInput(LANG.cc_sdwn_s, {title:LANG.cc_sdwn_l, convert:UC.toFloat, units:true, show:() => !poppedRec.contour}),
sep: UC.newBlank({class:"pop-sep"}),
expand: UC.newInput(LANG.cp_xpnd_s, {title:LANG.cp_xpnd_l, convert:UC.toFloat, units:true, show:() => !poppedRec.contour}),
expand: UC.newInput(LANG.cp_xpnd_s, {title:LANG.cp_xpnd_l, convert:UC.toFloat, units:true, xshow:() => !poppedRec.contour}),
refine: UC.newInput(LANG.cp_refi_s, {title:LANG.cp_refi_l, convert:UC.toInt, show:() => poppedRec.contour}),
smooth: UC.newInput(LANG.cp_smoo_s, {title:LANG.cp_smoo_l, convert:UC.toInt}),
tolerance: UC.newInput(LANG.ou_toll_s, {title:LANG.ou_toll_l, convert:UC.toFloat, bound:UC.bound(0,10.0), units:true, round:4, show:() => poppedRec.contour}),

View file

@ -1269,7 +1269,7 @@ class OpPocket extends CamOp {
toolDiam = toolOver;
}
if (contour) {
expand = engrave ? 0 : toolOver * 2;
expand = engrave ? 0 : expand;
}
if (expand) {
polys = POLY.offset(polys, expand);
@ -1298,7 +1298,8 @@ class OpPocket extends CamOp {
let count = engrave ? 1 : 999;
slice.camTrace = { tool, rate, plunge };
if (toolDiam) {
POLY.offset(clip, [ -toolDiam / 2, -toolOver ], {
const offs = contour ? [ expand ? expand : -0.02, -toolOver ] : [ -toolDiam / 2, -toolOver ];
POLY.offset(clip, offs, {
count, outs: slice.camLines = [], flat:true, z
});
} else {