fix file export names for laser, sla. add device max power for lasers
This commit is contained in:
parent
5c1cddbb1c
commit
cbfa05e1da
9 changed files with 33 additions and 22 deletions
|
|
@ -166,6 +166,10 @@ function round(v, zeros) {
|
||||||
return Math.round(v * pow) / pow;
|
return Math.round(v * pow) / pow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clamp(val, low, hi) {
|
||||||
|
return Math.max(low, Math.min(hi, val));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* used by {@link Polygon.trace} and {@link Polygon.intersect}
|
* used by {@link Polygon.trace} and {@link Polygon.intersect}
|
||||||
*/
|
*/
|
||||||
|
|
@ -590,6 +594,7 @@ base.util = {
|
||||||
sqr,
|
sqr,
|
||||||
lerp,
|
lerp,
|
||||||
time,
|
time,
|
||||||
|
clamp,
|
||||||
comma,
|
comma,
|
||||||
round,
|
round,
|
||||||
area2,
|
area2,
|
||||||
|
|
|
||||||
|
|
@ -559,7 +559,8 @@ function exportGCode(settings, data) {
|
||||||
let dev = settings.device;
|
let dev = settings.device;
|
||||||
let proc = settings.process;
|
let proc = settings.process;
|
||||||
let space = dev.gcodeSpace ? ' ' : '';
|
let space = dev.gcodeSpace ? ' ' : '';
|
||||||
let power = 255;
|
let max_power = dev.laserMaxPower || 255;
|
||||||
|
let power = max_power;
|
||||||
let cut_on = dev.gcodeLaserOn || dev.gcodeWaterOn || dev.gcodeKnifeDn || [];
|
let cut_on = dev.gcodeLaserOn || dev.gcodeWaterOn || dev.gcodeKnifeDn || [];
|
||||||
let cut_off = dev.gcodeLaserOff || dev.gcodeWaterOff || dev.gcodeKnifeUp || [];
|
let cut_off = dev.gcodeLaserOff || dev.gcodeWaterOff || dev.gcodeKnifeUp || [];
|
||||||
let knifeOn = proc.knifeOn;
|
let knifeOn = proc.knifeOn;
|
||||||
|
|
@ -569,14 +570,14 @@ function exportGCode(settings, data) {
|
||||||
exportElements(
|
exportElements(
|
||||||
settings,
|
settings,
|
||||||
data,
|
data,
|
||||||
function(min, max, power, speed) {
|
function(min, max, pct, speed) {
|
||||||
let width = (max.x - min.x),
|
let width = (max.x - min.x),
|
||||||
height = (max.y - min.y);
|
height = (max.y - min.y);
|
||||||
|
|
||||||
dx = min.x;
|
dx = min.x;
|
||||||
dy = min.y;
|
dy = min.y;
|
||||||
feedrate = `${space}F${speed}`;
|
feedrate = `${space}F${speed}`;
|
||||||
power = (256 * (power / 100)).toFixed(3);
|
power = (max_power * (pct / 100)).toFixed(3);
|
||||||
|
|
||||||
(dev.gcodePre || []).forEach(line => {
|
(dev.gcodePre || []).forEach(line => {
|
||||||
lines.push(line);
|
lines.push(line);
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ function init(kiri, api) {
|
||||||
print_min = print_min.toString().padStart(2,'0');
|
print_min = print_min.toString().padStart(2,'0');
|
||||||
print_hrs = print_hrs.toString().padStart(2,'0');
|
print_hrs = print_hrs.toString().padStart(2,'0');
|
||||||
|
|
||||||
$('print-filename').value = filename;
|
$('print-filename-sla').value = filename;
|
||||||
$('print-volume').value = (volume/1000).round(2);
|
$('print-volume').value = (volume/1000).round(2);
|
||||||
$('print-layers').value = layers;
|
$('print-layers').value = layers;
|
||||||
$('print-time').value = `${print_hrs}:${print_min}:${print_sec}`;
|
$('print-time').value = `${print_hrs}:${print_min}:${print_sec}`;
|
||||||
|
|
@ -94,7 +94,7 @@ function init(kiri, api) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveFile(api, file, ext) {
|
function saveFile(api, file, ext) {
|
||||||
api.util.download(file, $('print-filename').value + ext);
|
api.util.download(file, $('print-filename-sla').value + ext);
|
||||||
api.modal.hide();
|
api.modal.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -593,6 +593,7 @@ const conf = exports({
|
||||||
bedDepth: 200,
|
bedDepth: 200,
|
||||||
bedHeight: 2.5,
|
bedHeight: 2.5,
|
||||||
maxHeight: 100,
|
maxHeight: 100,
|
||||||
|
laserMaxPower: 255,
|
||||||
gcodePre: [],
|
gcodePre: [],
|
||||||
gcodePost: [],
|
gcodePost: [],
|
||||||
gcodeFExt: "",
|
gcodeFExt: "",
|
||||||
|
|
|
||||||
|
|
@ -209,6 +209,7 @@ gapp.register("kiri.devices", (root, exports) => {
|
||||||
ui.gcodeStrip,
|
ui.gcodeStrip,
|
||||||
ui.gcodeLaserOn,
|
ui.gcodeLaserOn,
|
||||||
ui.gcodeLaserOff,
|
ui.gcodeLaserOff,
|
||||||
|
ui.laserMaxPower,
|
||||||
ui.extPrev,
|
ui.extPrev,
|
||||||
ui.extNext,
|
ui.extNext,
|
||||||
ui.extAdd,
|
ui.extAdd,
|
||||||
|
|
|
||||||
|
|
@ -109,36 +109,36 @@ function exportLaserDialog(data, names) {
|
||||||
function download_svg() {
|
function download_svg() {
|
||||||
api.util.download(
|
api.util.download(
|
||||||
driver.exportSVG(settings, data),
|
driver.exportSVG(settings, data),
|
||||||
$('print-filename').value + ".svg"
|
$('print-filename-laser').value + ".svg"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function download_dxf() {
|
function download_dxf() {
|
||||||
api.util.download(
|
api.util.download(
|
||||||
driver.exportDXF(settings, data),
|
driver.exportDXF(settings, data),
|
||||||
$('print-filename').value + ".dxf"
|
$('print-filename-laser').value + ".dxf"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function download_gcode() {
|
function download_gcode() {
|
||||||
api.util.download(
|
api.util.download(
|
||||||
driver.exportGCode(settings, data),
|
driver.exportGCode(settings, data),
|
||||||
$('print-filename').value + ".gcode"
|
$('print-filename-laser').value + ".gcode"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// api.ajax("/kiri/output-laser.html", function(html) {
|
api.modal.show('xlaser');
|
||||||
api.modal.show('xlaser');
|
|
||||||
let segments = 0;
|
let segments = 0;
|
||||||
data.forEach(layer => { segments += layer.length });
|
data.forEach(layer => { segments += layer.length });
|
||||||
// ui.print.innerHTML = html;
|
|
||||||
$('print-filename').value = filename;
|
$('print-filename-laser').value = filename;
|
||||||
$('print-lines').value = util.comma(segments);
|
$('print-lines').value = util.comma(segments);
|
||||||
$('print-svg').onclick = download_svg;
|
$('print-svg').onclick = download_svg;
|
||||||
$('print-dxf').onclick = download_dxf;
|
$('print-dxf').onclick = download_dxf;
|
||||||
$('print-lg').onclick = download_gcode;
|
$('print-lg').onclick = download_gcode;
|
||||||
// api.modal.show('print');
|
|
||||||
// });
|
console.log('laser export', { fileroot, filename });
|
||||||
}
|
}
|
||||||
|
|
||||||
function bindField(field, varname) {
|
function bindField(field, varname) {
|
||||||
|
|
|
||||||
|
|
@ -996,6 +996,7 @@ gapp.register("kiri.init", (root, exports) => {
|
||||||
_____: newGroup(LANG.dv_gr_out, null, {group:"dgco", inline}),
|
_____: newGroup(LANG.dv_gr_out, null, {group:"dgco", inline}),
|
||||||
gcodeStrip: newBoolean(LANG.dv_strc_s, onBooleanClick, {title:LANG.dv_strc_l, modes:CAM}),
|
gcodeStrip: newBoolean(LANG.dv_strc_s, onBooleanClick, {title:LANG.dv_strc_l, modes:CAM}),
|
||||||
gcodeSpace: newBoolean(LANG.dv_tksp_s, onBooleanClick, {title:LANG.dv_tksp_l, modes:CAM_LZR}),
|
gcodeSpace: newBoolean(LANG.dv_tksp_s, onBooleanClick, {title:LANG.dv_tksp_l, modes:CAM_LZR}),
|
||||||
|
laserMaxPower: newInput(LANG.ou_maxp_s, {title:LANG.ou_maxp_l, modes:LASER, size:7, text:true}),
|
||||||
useLaser: newBoolean(LANG.dv_lazr_s, onBooleanClick, {title:LANG.dv_lazr_l, modes:CAM}),
|
useLaser: newBoolean(LANG.dv_lazr_s, onBooleanClick, {title:LANG.dv_lazr_l, modes:CAM}),
|
||||||
gcodeFExt: newInput(LANG.dv_fext_s, {title:LANG.dv_fext_l, modes:CAM_LZR, size:7, text:true}),
|
gcodeFExt: newInput(LANG.dv_fext_s, {title:LANG.dv_fext_l, modes:CAM_LZR, size:7, text:true}),
|
||||||
gcodeEd: newGroup(LANG.dv_gr_gco, $('dg'), {group:"dgcp", inline, modes:GCODE}),
|
gcodeEd: newGroup(LANG.dv_gr_gco, $('dg'), {group:"dgcp", inline, modes:GCODE}),
|
||||||
|
|
|
||||||
|
|
@ -643,7 +643,7 @@
|
||||||
<div id="mod-x-sla" class="mod-print mdialog f-col">
|
<div id="mod-x-sla" class="mod-print mdialog f-col">
|
||||||
<div class="header"><label>export</label></div>
|
<div class="header"><label>export</label></div>
|
||||||
<div id="print-info" class="f-col box">
|
<div id="print-info" class="f-col box">
|
||||||
<div><label>file name</label><input id="print-filename" size="20" spellcheck="false" /></div>
|
<div><label>file name</label><input id="print-filename-sla" size="20" spellcheck="false" /></div>
|
||||||
<div><label>resin used ML</label><input id="print-volume" size="10" spellcheck="false" /></div>
|
<div><label>resin used ML</label><input id="print-volume" size="10" spellcheck="false" /></div>
|
||||||
<div><label>layers</label><input id="print-layers" size="10" spellcheck="false" /></div>
|
<div><label>layers</label><input id="print-layers" size="10" spellcheck="false" /></div>
|
||||||
<div><label>print time</label><input id="print-time" size="10" spellcheck="false" /></div>
|
<div><label>print time</label><input id="print-time" size="10" spellcheck="false" /></div>
|
||||||
|
|
@ -656,7 +656,7 @@
|
||||||
<div id="mod-x-laser" class="mod-print mdialog f-col">
|
<div id="mod-x-laser" class="mod-print mdialog f-col">
|
||||||
<div class="header"><label>export</label></div>
|
<div class="header"><label>export</label></div>
|
||||||
<div id="print-info" class="f-col box">
|
<div id="print-info" class="f-col box">
|
||||||
<div><label>file name</label><input id="print-filename" size="20" spellcheck="false" /></div>
|
<div><label>file name</label><input id="print-filename-laser" size="20" spellcheck="false" /></div>
|
||||||
<div><label>segments</label><input id="print-lines" size="12" disabled="true" /></div>
|
<div><label>segments</label><input id="print-lines" size="12" disabled="true" /></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="header"><label>download</label></div>
|
<div class="header"><label>download</label></div>
|
||||||
|
|
|
||||||
|
|
@ -694,6 +694,8 @@ self.kiri.lang['en-us'] = {
|
||||||
ou_drkn_l: ["enable drag knife","output in gcode","cut radii are added","to corners with","cut down passes"],
|
ou_drkn_l: ["enable drag knife","output in gcode","cut radii are added","to corners with","cut down passes"],
|
||||||
ou_stak_s: "3D stack",
|
ou_stak_s: "3D stack",
|
||||||
ou_stak_l: ["output is a 3D stack of 2D paths rather than packing layers flat in 2D"],
|
ou_stak_l: ["output is a 3D stack of 2D paths rather than packing layers flat in 2D"],
|
||||||
|
ou_maxp_s: "max power",
|
||||||
|
ou_maxp_l: ["max power value in gcode. power % from settings will scale from 0 to this value"],
|
||||||
|
|
||||||
// OUTPUT FDM
|
// OUTPUT FDM
|
||||||
ou_nozl_s: "nozzle temp",
|
ou_nozl_s: "nozzle temp",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue