allow for z power ranges to be inverted

This commit is contained in:
Stewart Allen 2022-10-19 12:08:46 -04:00
commit b38e3ec65a
3 changed files with 16 additions and 12 deletions

View file

@ -1291,15 +1291,15 @@ CAM.init = function(kiri, api) {
off: UC.newRow([ UC.newButton(LANG.off, editOff) ], {class:"ext-buttons f-row"}),
sep: UC.newBlank({class:"pop-sep"}),
power: UC.newInput(LANG.cl_powr_s, {title:LANG.cl_powr_l, convert:UC.toFloat, bound:UC.bound(0,1.0), show:() => !poppedRec.adapt}),
flatz: UC.newInput(LANG.cl_flaz_s, {title:LANG.cl_flaz_l, convert:UC.toFloat, show:() => poppedRec.flat}),
minp: UC.newInput(LANG.cl_minp_s, {title:LANG.cl_minp_l, convert:UC.toFloat, bound:UC.bound(0,1.0), show:() => poppedRec.adapt}),
maxp: UC.newInput(LANG.cl_maxp_s, {title:LANG.cl_maxp_l, convert:UC.toFloat, bound:UC.bound(0,1.0), show:() => poppedRec.adapt}),
minz: UC.newInput(LANG.cl_minz_s, {title:LANG.cl_minz_l, convert:UC.toFloat, show:() => poppedRec.adapt}),
minp: UC.newInput(LANG.cl_minp_s, {title:LANG.cl_minp_l, convert:UC.toFloat, bound:UC.bound(0,1.0), show:() => poppedRec.adapt}),
maxz: UC.newInput(LANG.cl_maxz_s, {title:LANG.cl_maxz_l, convert:UC.toFloat, show:() => poppedRec.adapt}),
minz: UC.newInput(LANG.cl_minz_s, {title:LANG.cl_minz_l, convert:UC.toFloat, show:() => poppedRec.adapt}),
flatz: UC.newInput(LANG.cl_flaz_s, {title:LANG.cl_flaz_l, convert:UC.toFloat, show:() => poppedRec.flat}),
sep: UC.newBlank({class:"pop-sep"}),
adapt: UC.newBoolean(LANG.cl_adap_s, undefined, {title:LANG.cl_adap_l}),
adaptrp: UC.newBoolean(LANG.cl_adrp_s, undefined, {title:LANG.cl_adrp_l, show:() => poppedRec.adapt}),
flat: UC.newBoolean(LANG.cl_flat_s, undefined, {title:LANG.cl_flat_l}),
flat: UC.newBoolean(LANG.cl_flat_s, undefined, {title:LANG.cl_flat_l }),
};
const editDisable = gcodeEditor('Laser Disable Script', 'disable');

View file

@ -265,7 +265,11 @@ function prepEach(widget, settings, print, firstPoint, update) {
return point;
}
z -= minz;
power = minp + (z / deltaz) * (maxp - minp);
if (minp < maxp) {
power = minp + (z / deltaz) * (maxp - minp);
} else {
power = minp - (z / deltaz) * (minp - maxp);
}
}
if (lasering.flat) {
point.z = lasering.flatz;

View file

@ -563,15 +563,15 @@ self.kiri.lang['en-us'] = {
cl_adrp_l: "apply a moduluse of Z height using the given band to make repeating patterns",
cl_flat_s: "flatten",
cl_flat_l: "flatten output to a given Z height",
cl_flaz_s: "height",
cl_flaz_s: "flat height",
cl_flaz_l: ["flatten output to this Z height", "in workspace units"],
cl_minp_s: "min power",
cl_minp_l: ["lowest power for the Z band. when "],
cl_maxp_s: "max power",
cl_maxp_l: ["highest power for the Z band"],
cl_minz_s: "min height",
cl_minp_s: "z min power",
cl_minp_l: ["power setting at the lowest part of the Z band. may be higher or lower than the other end of the Z band."],
cl_maxp_s: "z max power",
cl_maxp_l: ["power setting at the highest part of the Z band. may be higher or lower than the other end of the Z band."],
cl_minz_s: "min z height",
cl_minz_l: ["lowest Z band position"],
cl_maxz_s: "max height",
cl_maxz_s: "max z height",
cl_maxz_l: ["highest Z band position. when set to 0, uses the highest Z point of the workspace"],
// CNC CUTOUT TABS