8000 lock export to device filetype by bakedPotatoLord · Pull Request #370 · GridSpace/grid-apps · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

lock export to device filetype #370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 18 additions & 25 deletions src/kiri/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,38 +106,31 @@ function exportLaserDialog(data, names) {
const filename = `${fileroot}-${(printSeq.toString().padStart(3,"0"))}`;
const settings = api.conf.get();
const driver = kiri.driver.LASER;

function download_svg() {
api.util.download(
driver.exportSVG(settings, data),
$('print-filename-laser').value + ".svg"
);
}

function download_dxf() {
api.util.download(
driver.exportDXF(settings, data),
$('print-filename-laser').value + ".dxf"
);
}

function download_gcode() {
const downloadBtn = $('download-laser')
const fileExt = settings.device.gcodeFExt.toLowerCase() ?? "gcode";
downloadBtn.innerHTML = fileExt

function downloadFile(){
let blob;
if (fileExt === "svg") {
blob = driver.exportSVG(settings, data)
} else if (fileExt === "dxf") {
blob = driver.exportDXF(settings, data)
}else{
blob = driver.exportGCode(settings, data)
}
api.util.download(
driver.exportGCode(settings, data),
$('print-filename-laser').value + ".gcode"
blob,
$('print-filename-laser').value + "." + fileExt
);
}

api.modal.show('xlaser');

let segments = 0;
data.forEach(layer => { segments += layer.length });

let segments = data.reduce((acc, layer) => acc + layer.length, 0);
$('print-filename-laser').value = filename;
$('print-lines').value = util.comma(segments);
$('print-svg').>
$('print-dxf').>
$('print-lg').>
downloadBtn.>
}

function bindField(field, varname) {
Expand Down
4 changes: 1 addition & 3 deletions web/kiri/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -709,9 +709,7 @@
</div>
<div class="header"><label>download</label></div>
<div class="f-row box">
<button id="print-svg" class="grow">svg</button>
<button id="print-dxf" class="grow">dxf</button>
<button id="print-lg" class="grow">gcode</button>
<button id="download-laser" class="grow" title="download file; change filetype in device options">gcode</button>
</div>
</div>
<!-- dynamic dialogs -->
Expand Down
0