/** Copyright Stewart Allen -- All Rights Reserved */ "use strict"; // dep: geo.base // dep: kiri-mode.sla.driver gapp.register("kiri-mode.sla.client", [], (root, exports) => { const { base, kiri } = root; const { driver } = kiri; const { util } = base; const { SLA } = driver; gapp.overlay(SLA, { init, printDownload }); function init(kiri, api) { api.event.on("mode.set", (mode) => { if (mode === 'SLA') { api.ui.func.preview.classList.add('hide'); } else { api.ui.func.preview.classList.remove('hide'); } }); } function printDownload(output, api, names) { const { file, width, height, layers, volume } = output; const fileroot = names[0] || "print"; const filename = `${fileroot}-${new Date().getTime().toString(36)}`; api.ajax("/kiri/output-sla.html", html => { api.ui.print.innerHTML = html; let settings = api.conf.get(), process = settings.process, device = settings.device, print_sec = (process.slaBaseLayers * process.slaBaseOn) + (layers - process.slaBaseLayers) * process.slaLayerOn; // add peel lift/drop times to total print time for (let i=0; i { saveFile(api, file, ".photon") }; break; case 'Anycubic.Photon.S': download.innerText += " .photons"; download.onclick = () => { saveFile(api, file, ".photons") }; break; case 'Creality.Halot.Sky': default: download.innerText += " .cxdlp"; download.onclick = () => { saveFile(api, file, ".cxdlp") }; break; } api.modal.show('print'); }); } function saveFile(api, file, ext) { api.util.download(file, $('print-filename').value + ext); api.modal.hide(); } });