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