add surface linear constraint and angle. rename fields

This commit is contained in:
Stewart Allen 2025-11-29 18:17:27 -05:00
commit 68db33df3f
3 changed files with 21 additions and 9 deletions

View file

@ -428,6 +428,7 @@ export const conf = {
camAreaMode: "clear",
camAreaTrace: "none",
camAreaSurface: "linear",
camAreaAngle: 0,
camAreaOver: 0.4,
camAreaDown: 1,
camAreaSpeed: 1000,

View file

@ -661,16 +661,22 @@ export function createPopOps() {
function isTrace() {
return env.poppedRec.mode === 'trace';
}
function isSurface() {
return env.poppedRec.mode === 'surface';
}
function isSurfaceLinear() {
return env.poppedRec.mode === 'surface' && env.poppedRec.sr_typ === 'linear';
}
createPopOp('area', {
spindle: 'camAreaSpindle',
tool: 'camAreaTool',
mode: 'camAreaMode',
tr_off: 'camAreaTrace',
sr_typ: 'camAreaSurface',
sr_type: 'camAreaSurface',
sr_angle: 'camAreaAngle',
over: 'camAreaOver',
down: 'camAreaDown',
rate: 'camAreaSpeed',
@ -687,7 +693,7 @@ export function createPopOps() {
tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
mode: UC.newSelect(LANG.mo_menu, {}, "opmode"),
tr_off: UC.newSelect(LANG.cc_offs_s, { title: LANG.cc_offs_l, show: isTrace }, "traceoff"),
sr_typ: UC.newSelect("pattern", { title: "pattern", show: isSurface }, "surftyp"),
sr_type: UC.newSelect("pattern", { title: "pattern", show: isSurface }, "surftyp"),
sep: UC.newBlank({ class: "pop-sep" }),
menu: UC.newRow([
UC.newButton("edge", traceAdd),
@ -696,7 +702,8 @@ export function createPopOps() {
outline: UC.newBoolean(LANG.cp_outl_s, undefined, { title: LANG.cp_outl_l, show: () => isClear() || isTrace() }),
expand: UC.newInput(LANG.cp_xpnd_s, { title: LANG.cp_xpnd_l, convert: toFloat, units }),
sep: UC.newBlank({ class: "pop-sep" }),
over: UC.newInput(LANG.cc_sovr_s, { title: LANG.cc_sovr_l, convert: toFloat, bound: UC.bound(0.001, 100.0), units, show: () => isClear() || isSurface() }),
sr_angle: UC.newInput("step angle", { title: "step angle", convert: toFloat, bound: UC.bound(0, 360), show: isSurfaceLinear }),
over: UC.newInput(LANG.cc_sovr_s, { title: LANG.cc_sovr_l, convert: toFloat, bound: UC.bound(0.001, 100.0), show: () => isClear() || isSurface() }),
down: UC.newInput(LANG.cc_sdwn_s, { title: LANG.cc_sdwn_l, convert: toFloat, bound: UC.bound(0, 100.0), units, show: () => isClear() || isTrace() }),
sep: UC.newBlank({ class: "pop-sep", show: isSurface }),
refine: UC.newInput(LANG.cp_refi_s, { title: LANG.cp_refi_l, convert: toInt, show: isSurface }),

View file

@ -20,7 +20,7 @@ class OpArea extends CamOp {
async slice(progress) {
const pocket = this;
let { op, state } = this;
let { tool, mode, down, over, follow, expand, tr_off, sr_typ, outline, refine, smooth, tolerance } = op;
let { tool, mode, down, over, follow, expand, outline, refine, smooth } = op;
let { ov_topz, ov_botz, ov_conv } = op;
let { settings, widget, tabs, color } = state;
let { addSlices, setToolDiam, cutTabs, healPolys, shadowAt, workarea } = state;
@ -158,6 +158,7 @@ class OpArea extends CamOp {
progress(proc, 'clear');
} else
if (mode === 'trace') {
let { tr_type } = op;
let zs = down ? base_util.lerp(zTop, bounds.min.z, down) : [ bounds.min.z ];
let zroc = 0;
let zinc = 1 / zs.length;
@ -166,10 +167,11 @@ class OpArea extends CamOp {
let slice = newLayer();
let layers = slice.output();
let outs = [];
if (tr_off === 'none') {
outs = [ area.clone().setZ(z) ];
if (tr_type === 'none') {
area = area.clone(true);
outs = [ zs.length > 1 ? area.setZ(z) : area ];
} else {
POLY.offset([ area ], tr_off === 'inside' ? [ -toolDiam / 2 ] : [ toolDiam / 2 ], {
POLY.offset([ area ], tr_type === 'inside' ? [ -toolDiam / 2 ] : [ toolDiam / 2 ], {
count: 1, outs, flat: true, z, minArea: 0
});
}
@ -191,10 +193,12 @@ class OpArea extends CamOp {
progress(proc, 'trace');
} else
if (mode === 'surface') {
if (sr_typ === 'linear') {
let { sr_type, sr_angle, tolerance } = op;
if (sr_type === 'linear') {
console.log({ sr_angle });
} else
if (sr_typ === 'offset') {
if (sr_type === 'offset') {
}
}