add laser z banding and flatten options
This commit is contained in:
parent
88ddef5bcf
commit
5f07f82eb3
6 changed files with 95 additions and 13 deletions
|
|
@ -1277,12 +1277,29 @@ CAM.init = function(kiri, api) {
|
|||
on: 'camLaserOn',
|
||||
off: 'camLaserOff',
|
||||
power: 'camLaserPower',
|
||||
adapt: 'camLaserAdaptive',
|
||||
adaptrp: 'camLaserAdaptMod',
|
||||
flat: 'camLaserFlatten',
|
||||
flatz: 'camLaserFlatZ',
|
||||
minp: 'camLaserPowerMin',
|
||||
maxp: 'camLaserPowerMax',
|
||||
minz: 'camLaserZMin',
|
||||
maxz: 'camLaserZMax',
|
||||
}).inputs = {
|
||||
enable: UC.newRow([ UC.newButton(LANG.enable, editEnable) ], {class:"ext-buttons f-row"}),
|
||||
on: UC.newRow([ UC.newButton(LANG.on, editOn) ], {class:"ext-buttons f-row"}),
|
||||
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)}),
|
||||
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}),
|
||||
maxz: UC.newInput(LANG.cl_maxz_s, {title:LANG.cl_maxz_l, convert:UC.toFloat, show:() => poppedRec.adapt}),
|
||||
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}),
|
||||
};
|
||||
|
||||
const editDisable = gcodeEditor('Laser Disable Script', 'disable');
|
||||
|
|
|
|||
|
|
@ -106,8 +106,8 @@ function prepEach(widget, settings, print, firstPoint, update) {
|
|||
plungeRate = process.camFastFeedZ,
|
||||
feedRate,
|
||||
lastTool,
|
||||
lastMode,
|
||||
lastPoint,
|
||||
currentOp,
|
||||
nextIsMove = true,
|
||||
synthPlunge = false,
|
||||
spindle = 0,
|
||||
|
|
@ -125,7 +125,7 @@ function prepEach(widget, settings, print, firstPoint, update) {
|
|||
newOutput.push(layerOut);
|
||||
}
|
||||
layerOut = [];
|
||||
layerOut.mode = op || lastMode;
|
||||
layerOut.mode = op || currentOp;
|
||||
layerOut.spindle = spindle;
|
||||
}
|
||||
|
||||
|
|
@ -139,7 +139,7 @@ function prepEach(widget, settings, print, firstPoint, update) {
|
|||
newOutput.push([{ gcode: text }]);
|
||||
if (layerOut.length) {
|
||||
layerOut = [];
|
||||
layerOut.mode = lastMode;
|
||||
layerOut.mode = currentOp;
|
||||
layerOut.spindle = spindle;
|
||||
}
|
||||
}
|
||||
|
|
@ -170,7 +170,7 @@ function prepEach(widget, settings, print, firstPoint, update) {
|
|||
}
|
||||
|
||||
function setLasering(bool, power = 0) {
|
||||
lasering = bool;
|
||||
lasering = bool ? currentOp : undefined;
|
||||
laserPower = power;
|
||||
}
|
||||
|
||||
|
|
@ -249,9 +249,28 @@ function prepEach(widget, settings, print, firstPoint, update) {
|
|||
* @param {number} [tool] tool
|
||||
*/
|
||||
function layerPush(point, emit, speed, tool) {
|
||||
layerOut.mode = lastMode;
|
||||
layerOut.mode = currentOp;
|
||||
if (lasering) {
|
||||
print.addOutput(layerOut, point, emit ? laserPower : emit, speed, tool, 'laser');
|
||||
let power = emit ? laserPower : 0;
|
||||
if (emit && lasering.adapt) {
|
||||
let { minz, maxz, minp, maxp, adaptrp } = lasering;
|
||||
maxz = maxz || wztop;
|
||||
let deltaz = maxz - minz;
|
||||
let { z } = point;
|
||||
if (adaptrp) {
|
||||
while (z > maxz) z -= deltaz;
|
||||
while (z < minz) z += deltaz;
|
||||
} else if (z < minz || z > maxz) {
|
||||
// skip outside of band
|
||||
return point;
|
||||
}
|
||||
z -= minz;
|
||||
power = minp + (z / deltaz) * (maxp - minp);
|
||||
}
|
||||
if (lasering.flat) {
|
||||
point.z = lasering.flatz;
|
||||
}
|
||||
print.addOutput(layerOut, point, power, speed, tool, 'laser');
|
||||
} else {
|
||||
print.addOutput(layerOut, point, emit, speed, tool);
|
||||
}
|
||||
|
|
@ -362,7 +381,7 @@ function prepEach(widget, settings, print, firstPoint, update) {
|
|||
}
|
||||
|
||||
// todo synthesize move speed from feed / plunge accordingly
|
||||
layerOut.mode = lastMode;
|
||||
layerOut.mode = currentOp;
|
||||
layerOut.spindle = spindle;
|
||||
lastPoint = layerPush(
|
||||
point,
|
||||
|
|
@ -420,7 +439,7 @@ function prepEach(widget, settings, print, firstPoint, update) {
|
|||
for (let op of widget.camops) {
|
||||
setTolerance(0);
|
||||
nextIsMove = true;
|
||||
lastMode = op.op;
|
||||
currentOp = op.op;
|
||||
let weight = op.weight();
|
||||
newLayer(op.op);
|
||||
op.prepare(ops, (progress, message) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue