fix slicing of slabs (requires pocket bottom revisit)

This commit is contained in:
Stewart Allen 2025-12-09 18:31:41 -05:00
commit a077cf5739
6 changed files with 22 additions and 10 deletions

View file

@ -241,7 +241,8 @@ function updateFieldsFromSettings(setrec, uirec = api.ui, opt = {}) {
if (!uirec.hasOwnProperty(key)) {
continue;
}
let uie = uirec[key], typ = uie ? uie.type : null;
let uie = uirec[key],
typ = uie ? uie.type : null;
if (opt.trace) {
console.log({ key, uie, typ, val });
}

View file

@ -38,6 +38,7 @@ export const UI = {
bound,
toInt,
toFloat,
toFloatArray,
toDegsFloat,
isSticky,
setSticky,
@ -327,22 +328,28 @@ function toInt() {
function toFloat() {
let nv = this.value !== '' ? parseFloat(this.value) : null;
if (nv !== null && this.bound) nv = this.bound(nv);
this.value = nv;
if (this.setv) {
return this.setv(nv * units);
} else {
this.value = nv;
}
return nv;
}
function toFloatArray() {
let nv = this.value !== '' ? this.value.split(',').map(v => parseFloat(v)) : null;
console.log({ toFloatArray: nv });
if (this.bound) nv = nv.map(v => this.bound(v));
this.array = nv;
return nv;
}
function toDegsFloat(){
let nv = this.value !== '' ? parseFloat(this.value) : null;
if (nv !== null && this.bound) nv = this.bound(nv);
nv = (nv+360)% 360; // bound the val to 0-359.99
this.value = nv;
if (this.setv) {
return this.setv(nv);
} else {
this.value = nv;
}
return nv;
}
@ -610,8 +617,8 @@ function newInput(label, opt = {}) {
hide = opt.hide,
size = opt.size ?? 5,
height = opt.height || 0,
ip = height > 1 ? DOC.createElement('textarea') : DOC.createElement('input'),
action = opt.action || bindTo || inputAction;
action = opt.action || bindTo || inputAction,
ip = height > 1 ? DOC.createElement('textarea') : DOC.createElement('input');
row.appendChild(newLabel(label));
row.appendChild(ip);

View file

@ -920,7 +920,7 @@ class Widget {
if (a.z < z && b.z < z && c.z < z) {
// skip faces under threshold
continue;
} else if (a.z === z && a.z === b.z && a.z === c.z) {
// } else if (a.z === z && a.z === b.z && a.z === c.z) {
// skip faces coplanar with z (shadow looks up)
} else if (a.z >= z && b.z >= z && c.z >= z) {
found.push([a, b, c]);

View file

@ -14,7 +14,7 @@ const { MODES } = api.const;
const { uc: UC } = api;
const { alerts, conf } = api;
const { current: LANG } = api.language;
const { toInt, toFloat } = UC;
const { toInt, toFloat, toFloatArray } = UC;
const units = true;
let seed = Date.now();

View file

@ -15,6 +15,10 @@ class OpOutline extends CamOp {
async slice(progress) {
let { op, state } = this;
let { shadow, tool, widget } = state;
let shadow_base = shadow.base;
if (!(shadow_base && shadow_base.length)) {
throw 'missing shadow base';
}
let areas = POLY.flatten(POLY.expand(shadow.base, tool.fluteDiameter() / 2 - 0.001));
let cutout = {
areas: { [widget.id]: areas.map(p => p.toArray()) },

View file

@ -1412,7 +1412,7 @@ details[open] summary::after {
background-color: var(--blue-2);
}
#oplist > div {
padding: 5px 20px 5px 7px !important;
padding: 4px 20px 4px 7px !important;
}
#oplist > div, .opdiv {
display: flex;