diff --git a/js/kiri-driver-cam.js b/js/kiri-driver-cam.js index 62d196e2..465ad3f7 100644 --- a/js/kiri-driver-cam.js +++ b/js/kiri-driver-cam.js @@ -812,6 +812,18 @@ var gs_kiri_cam = exports; shellFinish, facePolys; + if (settings.stock.x < bounds.max.x - bounds.min.x) { + return ondone('stock too small for part. disable or use offset stock'); + } + + if (settings.stock.y < bounds.max.y - bounds.min.y) { + return ondone('stock too small for part. disable or use offset stock'); + } + + if (settings.stock.z < bounds.max.z - bounds.min.z) { + return ondone('stock too small for part. disable or use offset stock'); + } + if (sliceDepth <= 0.05) { return ondone(`invalid slice depth (${sliceDepth.toFixed(2)} ${unitsName})`); } diff --git a/js/kiri-driver-sla.js b/js/kiri-driver-sla.js index bebb2f9f..c784b07f 100644 --- a/js/kiri-driver-sla.js +++ b/js/kiri-driver-sla.js @@ -41,6 +41,10 @@ let gs_kiri_sla = exports; let process = settings.process, device = settings.device; + if (!self.OffscreenCanvas) { + return ondone("browser lacks support for OffscreenCanvas",true); + } + // calculate % complete and call onupdate() function doupdate(slices, index, from, to, msg) { onupdate(0.5 + (from + ((index / slices.length) * (to - from))) * 0.5, msg); @@ -64,7 +68,7 @@ let gs_kiri_sla = exports; SLICER.sliceWidget(widget, { height: process.slaSlice || 0.05, - add: true + add: !process.slaOpenTop }, function(slices) { widget.slices = slices.filter(slice => slice.tops.length); // reset for solids and support projections @@ -83,7 +87,7 @@ let gs_kiri_sla = exports; } }, "slice"); forSlices(slices, 0.3, 0.6, (slice) => { - slice.doDiff(0.00001, 0.005, true); + slice.doDiff(0.00001, 0.005, !process.slaOpenBase); }, "delta"); if (solidLayers) { forSlices(slices, 0.6, 0.7, (slice) => { diff --git a/js/kiri-init.js b/js/kiri-init.js index fb79332c..792b3152 100644 --- a/js/kiri-init.js +++ b/js/kiri-init.js @@ -103,7 +103,7 @@ var gs_kiri_init = exports; if (isDark !== control.dark) { LOC.reload(); } - UC.setExpert(control.expert); + API.mode.set_expert(control.expert); } function onLayerToggle() { diff --git a/js/kiri.js b/js/kiri.js index 6f615903..ac44b204 100644 --- a/js/kiri.js +++ b/js/kiri.js @@ -21,9 +21,9 @@ self.kiri.copyright = exports.COPYRIGHT; DOC = self.document, LOC = self.location, HOST = LOC.host.split(':'), - LOCAL = self.debug, SETUP = parseOpt(LOC.search.substring(1)), SECURE = isSecure(LOC.protocol), + LOCAL = self.debug && !SETUP.remote, SDB = MOTO.KV, ODB = KIRI.odb = new MOTO.Storage(SETUP.d ? SETUP.d[0] : 'kiri'), SPACE = KIRI.space = MOTO.Space, @@ -60,7 +60,8 @@ self.kiri.copyright = exports.COPYRIGHT; topZ = 0, showFavorites = SDB.getItem('dev-favorites') === 'true', alerts = [], - grouping = false; + grouping = false, + skipSliceView = false; if (SETUP.rm) renderMode = parseInt(SETUP.rm[0]); DBUG.enable(); @@ -215,7 +216,8 @@ self.kiri.copyright = exports.COPYRIGHT; get_id: function() { return MODE }, get: getMode, set: setMode, - switch: switchMode + switch: switchMode, + set_expert: setExpert }, print: { get: function() { return currentPrint }, @@ -638,9 +640,8 @@ self.kiri.copyright = exports.COPYRIGHT; } function preparePrint(callback) { - let isSLA = MODE === MODES.SLA, - tpFactor = isSLA ? 0.5 : 1, - tpBase = isSLA ? 0.5 : 0; + let tpFactor = skipSliceView ? 0.5 : 1, + tpBase = skipSliceView ? 0.5 : 0; // kick off slicing it hasn't been done already for (let i=0; i < WIDGETS.length; i++) { @@ -665,7 +666,7 @@ self.kiri.copyright = exports.COPYRIGHT; forAllWidgets(function(widget) { widget.setColor(color.cam_preview); }); - } else if (!isSLA) { + } else if (!skipSliceView) { setOpacity(color.preview_opacity); } @@ -676,7 +677,7 @@ self.kiri.copyright = exports.COPYRIGHT; }, function() { setProgress(0); - if (isSLA) { + if (skipSliceView) { setOpacity(0); } @@ -738,8 +739,7 @@ self.kiri.copyright = exports.COPYRIGHT; countdown = WIDGETS.length, preserveMax = API.var.layer_max, preserveLayer = API.var.layer_at, - isSLA = MODE === MODES.SLA, - tpFactor = isSLA ? 0.5 : 1, + tpFactor = skipSliceView ? 0.5 : 1, totalProgress, track = {}; @@ -760,7 +760,7 @@ self.kiri.copyright = exports.COPYRIGHT; widget.setColor(color.slicing); widget.slice(settings, function(sliced, error) { let mark = UTIL.time(); - if (!isSLA) { + if (!skipSliceView) { // on done widget.render(renderMode, MODE === MODES.CAM); // clear wireframe @@ -782,8 +782,10 @@ self.kiri.copyright = exports.COPYRIGHT; } // on the last exit, update ui and call the callback if (--countdown === 0 || error || errored) { - if (isSLA) { - preparePrint(callback); + if (skipSliceView) { + if (!error) { + preparePrint(callback); + } } else { setProgress(0); showSlices(preserveLayer); @@ -1851,6 +1853,11 @@ self.kiri.copyright = exports.COPYRIGHT; UI.layerView.style.display = bool ? 'flex' : 'none'; } + function setExpert(bool) { + UC.setExpert(UI.expert.checked = control.expert = bool); + updateSkipSliceView(); + } + function getMode() { return settings.mode; } @@ -1889,22 +1896,27 @@ self.kiri.copyright = exports.COPYRIGHT; UI.modeCAM.setAttribute('class', MODE === MODES.CAM ? 'buton' : ''); UI.modeLASER.setAttribute('class', MODE === MODES.LASER ? 'buton' : ''); UI.mode.style.display = lock ? 'none' : ''; - UI.modePreview.style.display = MODE === MODES.SLA ? 'none' : ''; UI.modeTable.style.display = lock ? 'none' : ''; if (camStock) { camStock.material.visible = settings.mode === 'CAM'; } API.space.restore(null, true); - // if (MODE !== MODES.FDM) platform.layout(); if (then) then(); triggerSettingsEvent(); platformUpdateSelected(); updateFields(); + updateSkipSliceView(); if (settings.device.new) { API.show.devices(); } } + function updateSkipSliceView() { + skipSliceView = MODE === MODES.SLA && + (!LOCAL || settings.controller.expert !== LOCAL); + UI.modePreview.style.display = skipSliceView ? 'none' : ''; + } + function currentDeviceName() { return settings.filter[getMode()]; }