better units / round handling. fix ruler in inches

This commit is contained in:
Stewart Allen 2021-01-10 19:10:55 -05:00
commit 2118098be9
5 changed files with 27 additions and 20 deletions

View file

@ -7,20 +7,17 @@
* `P` duplicate objects should share same slice data unless rotated or scaled
* `P` allow selection to me decimated on demand (context menu?)
* `P` improve decimation speed by avoiding in/out of Point?
* `P` improve decimation speed: omit point conversion or use wasm
* `P` client/worker interface normalization
# FDM
* `B` first rough step too far down in certain circumstances
* `B` fix adaptive slicing with multi-extruder
* `B` fix supports with grouped parts
* `B` multi-extruder rendering of raft fails to offset the rest of the print
* `B` multi-extruder purge blocks fail to generate properly for rafts
* `F` belt: first layer settings apply to z=0 lines
* `F` belt: add z=0 brim controls
* `F` belt: gcode parsing layer detection, rotation, unskew
* `F` slicing controls per user-defined z-region
* `F` control for size of purge block (with 0=disabled)
* `F` add separate fill speed control
@ -35,7 +32,6 @@
* `F` first layer support speed should be same as shell speed
* `F` apply finish speed to exposed top and underside flat areas
* `F` expand internal supporting flats / solids before projection
* `F` continuous printing (z belt systems)
* `P` implement infill clipping in wasm
* `P` solid fill the tops of supports for down facing flats
@ -49,7 +45,8 @@
# FDM - BELT
# `B` z hop = y hop
* `B` fix supports for belt printing
* `F` hide layer lines under print
# CAM
@ -63,6 +60,7 @@
* `B` outside cutting direction in roughing mode inverted
* `B` on rotation, tabs dissociate from parts whose center changes with rotation
* `F` add "step down" to tracing and add "inside" / "outside" modes
* `F` new registration style: offset cutout
* `F` add climb/conventional into each operation
* `F` z thru should apply to any thru hole

View file

@ -1499,8 +1499,8 @@
device: UC.newGroup(LANG.dv_gr_dev, $('device1'), {group:"ddev", inline:true, class:"noshow"}),
deviceName: UC.newInput(LANG.dv_name_s, {title:LANG.dv_name_l, size:"65%", text:true, action:updateDeviceName}),
bedWidth: UC.newInput(LANG.dv_bedw_s, {title:LANG.dv_bedw_l, convert:UC.toFloat, size:6, units:true}),
bedDepth: UC.newInput(LANG.dv_bedd_s, {title:LANG.dv_bedd_l, convert:UC.toFloat, size:6, units:true}),
bedWidth: UC.newInput(LANG.dv_bedw_s, {title:LANG.dv_bedw_l, convert:UC.toFloat, size:6, units:true, round:2}),
bedDepth: UC.newInput(LANG.dv_bedd_s, {title:LANG.dv_bedd_l, convert:UC.toFloat, size:6, units:true, round:2}),
maxHeight: UC.newInput(LANG.dv_bedh_s, {title:LANG.dv_bedh_l, convert:UC.toFloat, size:6, modes:FDM_SLA}),
spindleMax: UC.newInput(LANG.dv_spmx_s, {title:LANG.dv_spmx_l, convert:UC.toInt, size: 6, modes:CAM}),
deviceOrigin: UC.newBoolean(LANG.dv_orgc_s, onBooleanClick, {title:LANG.dv_orgc_l, modes:FDM_LASER_SLA}),

View file

@ -379,10 +379,13 @@
function toFloat() {
let nv = this.value !== '' ? parseFloat(this.value) : null;
if (nv !== null && this.bound) nv = this.bound(nv);
this.value = nv;
// this.value = nv;
if (this.setv) {
return this.real = nv * units;
};
return this.setv(nv * units);
// return this.real = (nv * units);
} else {
this.value = nv;
}
return nv;
}
@ -686,7 +689,7 @@
}
});
if (opt.units) {
addUnits(ip);
addUnits(ip, opt.round || 3);
}
}
if (!ip.convert) ip.convert = raw.bind(ip);
@ -695,15 +698,16 @@
return ip;
}
function addUnits(input) {
function addUnits(input, round) {
setters.push(input);
input.setv = function(value) {
if (typeof(value) === 'number') {
input.real = value;
input.value = value / units;
input.value = (value / units).round(round);
} else {
input.value = value;
}
return input.real;
};
return input;
}

View file

@ -34,7 +34,7 @@
restoreSupports(api.widgets.all());
});
api.event.on("settings.saved", (settings) => {
api.ui.fdmSupport.style.display = settings.device.bedBelt ? 'none' : 'flex';
api.ui.fdmSupport.style.display = lastMode === 'CAM' || settings.device.bedBelt ? 'none' : 'flex';
});
api.event.on("button.click", target => {
switch (target) {

View file

@ -415,6 +415,11 @@
}
}
function modMatch(val, mod) {
let mv = Math.abs(val) % mod;
return (mv < 1) || ((mod - mv) < 1);
}
function updateGrid() {
let { view, unitMinor, unitMajor, colorMajor, colorMinor } = grid;
let oldView = view;
@ -444,22 +449,22 @@
for (let x=0; x>x1; x -= unitMinor) {
let oh = isRound ? Math.sqrt(1-(x/xh)*(x/xh)) * yh : yh;
let arr = Math.abs(x % unitMajor) < 0.1 ? majors : minors;
let arr = modMatch(x, unitMajor) ? majors : minors;
arr.append({x:x-xo, y:-oh, z:zp}).append({x:x-xo, y:oh, z:zp});
}
for (let x=0; x<x2; x += unitMinor) {
let oh = isRound ? Math.sqrt(1-(x/xh)*(x/xh)) * yh : yh;
let arr = Math.abs(x % unitMajor) < 0.1 ? majors : minors;
let arr = modMatch(x, unitMajor) ? majors : minors;
arr.append({x:x-xo, y:-oh, z:zp}).append({x:x-xo, y:oh, z:zp});
}
for (let y=0; y>y1; y -= unitMinor) {
let ow = isRound ? Math.sqrt(1-(y/yh)*(y/yh)) * xh : xh;
let arr = Math.abs(y % unitMajor) < 0.1 ? majors : minors;
let arr = modMatch(y, unitMajor) ? majors : minors;
arr.append({x:-ow, y:y-yo, z:zp}).append({x:ow, y:y-yo, z:zp});
}
for (let y=0; y<y2; y += unitMinor) {
let ow = isRound ? Math.sqrt(1-(y/yh)*(y/yh)) * xh : xh;
let arr = Math.abs(y % unitMajor) < 0.1 ? majors : minors;
let arr = modMatch(y, unitMajor) ? majors : minors;
arr.append({x:-ow, y:y-yo, z:zp}).append({x:ow, y:y-yo, z:zp});
}