stop slicing on errors. alert when no cam processes selected

This commit is contained in:
Stewart Allen 2017-12-31 12:57:26 -05:00
commit 0f31315f4d
4 changed files with 19 additions and 7 deletions

View file

@ -714,6 +714,10 @@ var gs_kiri_cam = exports;
return ondone("invalid slice depth"); return ondone("invalid slice depth");
} }
if (!(procRough || procFinish || procFacing || procDrill)) {
return ondone("no processes selected");
}
// cut outside traces at the right points // cut outside traces at the right points
const addCutoutTabs = function(slice, toolDiam) { const addCutoutTabs = function(slice, toolDiam) {
// too high // too high

View file

@ -547,13 +547,14 @@ var gs_kiri_widget = exports;
if (reply.send_end) widget.stats.load_time = widget.xfer.start - reply.send_end; if (reply.send_end) widget.stats.load_time = widget.xfer.start - reply.send_end;
if (reply.slices) { widget.clearSlices(); widget.slices = [] }; if (reply.slices) { widget.clearSlices(); widget.slices = [] };
if (reply.slice) widget.slices.push(KIRI.codec.decode(reply.slice, {mesh:widget.mesh})); if (reply.slice) widget.slices.push(KIRI.codec.decode(reply.slice, {mesh:widget.mesh}));
if (reply.done) { if (reply.error) {
widget.cancel = true;
ondone(false, reply.error);
}
if (reply.done && !widget.cancel) {
ondone(true); ondone(true);
widget.modified = false; widget.modified = false;
} }
if (reply.error) {
alert(reply.error);
}
}); });
} else { } else {

View file

@ -1193,7 +1193,7 @@ self.kiri.license = exports.LICENSE;
widget.stats.progress = 0; widget.stats.progress = 0;
widget.setColor(widget_slicing_color); widget.setColor(widget_slicing_color);
widget.slice(settings, function(sliced) { widget.slice(settings, function(sliced, error) {
var mark = UTIL.time(); var mark = UTIL.time();
// on done // on done
widget.render(renderMode, MODE === MODES.CAM); widget.render(renderMode, MODE === MODES.CAM);
@ -1214,7 +1214,7 @@ self.kiri.license = exports.LICENSE;
firstMesh = false; firstMesh = false;
} }
// on the last exit, update ui and call the callback // on the last exit, update ui and call the callback
if (--countdown === 0) { if (--countdown === 0 || error) {
setProgress(0); setProgress(0);
showSlices(preserveLayer); showSlices(preserveLayer);
if (callback && typeof callback === 'function') callback(); if (callback && typeof callback === 'function') callback();
@ -1222,6 +1222,13 @@ self.kiri.license = exports.LICENSE;
} }
// update slider window // update slider window
onControlResize(); onControlResize();
// handle slicing errors
if (error) {
setViewMode(VIEWS.ARRANGE);
setOpacity(model_opacity);
widgetDeselect();
alert(error);
}
}, function(update, msg) { }, function(update, msg) {
if (msg !== lastMsg) { if (msg !== lastMsg) {
var mark = UTIL.time(); var mark = UTIL.time();

View file

@ -1,7 +1,7 @@
var exports = { var exports = {
COPYRIGHT:"Copyright (C) 2014-2017 Stewart Allen <stewart@neuron.com> - All Rights Reserved", COPYRIGHT:"Copyright (C) 2014-2017 Stewart Allen <stewart@neuron.com> - All Rights Reserved",
LICENSE:"Unauthorized copying, modification and re-distribution are strictly prohibited without prior written consent.", LICENSE:"Unauthorized copying, modification and re-distribution are strictly prohibited without prior written consent.",
VERSION:"1.0.75" VERSION:"1.0.76"
}; };
if (!module) var module = {}; if (!module) var module = {};
module.exports = exports; module.exports = exports;