make first part of slicing cancellable
This commit is contained in:
parent
217129a4fd
commit
26bf2baf5e
6 changed files with 55 additions and 24 deletions
|
|
@ -71,7 +71,7 @@ var gs_kiri_fdm = exports;
|
||||||
}, onSliceDone, onSliceUpdate);
|
}, onSliceDone, onSliceUpdate);
|
||||||
|
|
||||||
function onSliceUpdate(update) {
|
function onSliceUpdate(update) {
|
||||||
onupdate(0.0 + update * 0.5);
|
return onupdate(0.0 + update * 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSliceDone(slices) {
|
function onSliceDone(slices) {
|
||||||
|
|
|
||||||
|
|
@ -257,9 +257,10 @@ var gs_kiri_slicer = exports;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -- synchronous slice -- can't be cancelled --
|
||||||
// create a Slice for each z offset in the zIndexes array
|
// create a Slice for each z offset in the zIndexes array
|
||||||
for (var i = 0; i < zIndexes.length; i++) {
|
for (var i = 0; i < zIndexes.length; i++) {
|
||||||
// mark the slice height
|
// slice next layer and add to slices[] array
|
||||||
sliceZ(zIndexes[i], zHeights[i]);
|
sliceZ(zIndexes[i], zHeights[i]);
|
||||||
// kill slicing if onupdate() returns 42
|
// kill slicing if onupdate() returns 42
|
||||||
if (onupdate(i / zIndexes.length) === 42) {
|
if (onupdate(i / zIndexes.length) === 42) {
|
||||||
|
|
@ -283,6 +284,39 @@ var gs_kiri_slicer = exports;
|
||||||
|
|
||||||
// pass Slices array back to ondone function
|
// pass Slices array back to ondone function
|
||||||
ondone(slices);
|
ondone(slices);
|
||||||
|
*/
|
||||||
|
|
||||||
|
var sliceIndex = 0;
|
||||||
|
|
||||||
|
function kickSlice() {
|
||||||
|
sliceZ(zIndexes[sliceIndex], zHeights[sliceIndex]);
|
||||||
|
// kill slicing if onupdate() returns 42
|
||||||
|
if (onupdate(sliceIndex / zIndexes.length) === 42) {
|
||||||
|
return ondone(null);
|
||||||
|
}
|
||||||
|
if (++sliceIndex < zIndexes.length) {
|
||||||
|
setTimeout(kickSlice, 0);
|
||||||
|
} else {
|
||||||
|
// for cam, mark top and bottom as mandatory (hasFlats)
|
||||||
|
if (options.cam && slices.length > 0) {
|
||||||
|
slices[0].hasFlats = true;
|
||||||
|
slices[slices.length-1].hasFlats = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// connect slices into linked list for island/bridge projections
|
||||||
|
for (i=1; i<slices.length; i++) {
|
||||||
|
slices[i-1].up = slices[i];
|
||||||
|
slices[i].down = slices[i-1];
|
||||||
|
}
|
||||||
|
|
||||||
|
slices.slice_time = time() - timeStart;
|
||||||
|
|
||||||
|
// pass Slices array back to ondone function
|
||||||
|
ondone(slices);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
kickSlice();
|
||||||
|
|
||||||
/** ***** SLICING FUNCTIONS ***** */
|
/** ***** SLICING FUNCTIONS ***** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -577,7 +577,12 @@ var gs_kiri_widget = exports;
|
||||||
|
|
||||||
var catchupdate = function(progress, message) {
|
var catchupdate = function(progress, message) {
|
||||||
onupdate(progress, message);
|
onupdate(progress, message);
|
||||||
return widget.cancel ? 42 : 0;
|
if (widget.cancel) {
|
||||||
|
ondone("canceled");
|
||||||
|
return 42;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var driver = null;
|
var driver = null;
|
||||||
|
|
|
||||||
|
|
@ -165,13 +165,14 @@ if (self.window) {
|
||||||
},
|
},
|
||||||
|
|
||||||
cancel: function(data) {
|
cancel: function(data) {
|
||||||
// console.log({work_cancel: data});
|
|
||||||
if (data.id) {
|
if (data.id) {
|
||||||
var widget = cache[data.id];
|
var widget = cache[data.id];
|
||||||
if (widget) widget.cancel = true;
|
if (widget) widget.cancel = true;
|
||||||
} else {
|
} else {
|
||||||
for (var id in cache) {
|
for (var id in cache) {
|
||||||
if (cache.hasOwnProperty(id)) cache[id].cancel = true;
|
if (cache.hasOwnProperty(id)) {
|
||||||
|
cache[id].cancel = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -188,8 +189,8 @@ if (self.window) {
|
||||||
last = util.time(),
|
last = util.time(),
|
||||||
now;
|
now;
|
||||||
|
|
||||||
// clear previous widget data before reslice
|
// do it here so cancel can work
|
||||||
delete cache[data.id];
|
cache[data.id] = widget;
|
||||||
|
|
||||||
// fake mesh object to satisfy printing
|
// fake mesh object to satisfy printing
|
||||||
widget.mesh = {
|
widget.mesh = {
|
||||||
|
|
@ -199,6 +200,7 @@ if (self.window) {
|
||||||
|
|
||||||
widget.slice(settings, function(error) {
|
widget.slice(settings, function(error) {
|
||||||
if (error) {
|
if (error) {
|
||||||
|
delete cache[data.id];
|
||||||
send.data({error: error});
|
send.data({error: error});
|
||||||
} else {
|
} else {
|
||||||
var slices = widget.slices || [];
|
var slices = widget.slices || [];
|
||||||
|
|
@ -215,7 +217,7 @@ if (self.window) {
|
||||||
}
|
}
|
||||||
send.done({done: true});
|
send.done({done: true});
|
||||||
// cache results for future printing
|
// cache results for future printing
|
||||||
cache[data.id] = widget;
|
// cache[data.id] = widget;
|
||||||
}, function(update, msg) {
|
}, function(update, msg) {
|
||||||
now = util.time();
|
now = util.time();
|
||||||
if (now - last < 10 && update < 0.99) return;
|
if (now - last < 10 && update < 0.99) return;
|
||||||
|
|
|
||||||
|
|
@ -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.1.8c"
|
VERSION:"1.1.9"
|
||||||
};
|
};
|
||||||
if (!module) var module = {};
|
if (!module) var module = {};
|
||||||
module.exports = exports;
|
module.exports = exports;
|
||||||
|
|
|
||||||
20
notes.md
20
notes.md
|
|
@ -1,6 +1,5 @@
|
||||||
# Kiri:Moto todo
|
# Kiri:Moto todo
|
||||||
|
|
||||||
* fix slicing cancellation
|
|
||||||
* widget general add-ons (fdm supports, cam tabs)
|
* widget general add-ons (fdm supports, cam tabs)
|
||||||
* extend mesh object to store raw + annotations (rot,scale,pos), share raw data w/ dups, encode/decode
|
* extend mesh object to store raw + annotations (rot,scale,pos), share raw data w/ dups, encode/decode
|
||||||
* bail on decimation if it's proving ineffective
|
* bail on decimation if it's proving ineffective
|
||||||
|
|
@ -30,11 +29,6 @@
|
||||||
* option to support interior bridges when 0% infill
|
* option to support interior bridges when 0% infill
|
||||||
* fix multiple part layout export offset (resend position @ print time)
|
* fix multiple part layout export offset (resend position @ print time)
|
||||||
|
|
||||||
# Laser todo
|
|
||||||
|
|
||||||
* overcuts, radii for drag knives
|
|
||||||
* sla :: svg modified from http://garyhodgson.github.io/slic3rsvgviewer/?file=examples/belt_pulley3.svg
|
|
||||||
|
|
||||||
# CAM todo
|
# CAM todo
|
||||||
|
|
||||||
* add imperial / metric units switch in (future) global config options
|
* add imperial / metric units switch in (future) global config options
|
||||||
|
|
@ -66,20 +60,16 @@
|
||||||
* linear x/y not obeying inset from pocket only
|
* linear x/y not obeying inset from pocket only
|
||||||
* check normals for downward facing facets. mark top for slice skirt/pancake
|
* check normals for downward facing facets. mark top for slice skirt/pancake
|
||||||
|
|
||||||
# References
|
# Laser todo
|
||||||
|
|
||||||
* shader examples to enable object-clipping
|
* overcuts, radii for drag knives
|
||||||
-----
|
* sla :: svg modified from http://garyhodgson.github.io/slic3rsvgviewer/?file=examples/belt_pulley3.svg
|
||||||
* http://jsfiddle.net/LK84y/9/
|
|
||||||
* http://www.html5rocks.com/en/tutorials/webgl/shaders/
|
# References
|
||||||
|
|
||||||
* other
|
* other
|
||||||
-----
|
-----
|
||||||
* http://lcamtuf.coredump.cx/gcnc/full/
|
* http://lcamtuf.coredump.cx/gcnc/full/
|
||||||
* http://www.tcs.fudan.edu.cn/rudolf/Courses/Algorithms/Alg_cs_07w/Webprojects/Zhaobo_hull/
|
|
||||||
* https://en.wikipedia.org/wiki/Graham_scan
|
|
||||||
* http://www.cambam.info/doc/0.9.7/cam/Pocket.aspx
|
|
||||||
* http://hackaday.com/2016/01/22/pack-your-plywood-cuts-with-genetic-algortihms/
|
|
||||||
* http://wiki.imal.org/howto/cnc-milling-introduction-cutting-tools
|
* http://wiki.imal.org/howto/cnc-milling-introduction-cutting-tools
|
||||||
* http://www.twak.co.uk/2011/01/degeneracy-in-weighted-straight.html
|
* http://www.twak.co.uk/2011/01/degeneracy-in-weighted-straight.html
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue