Merge branch 'master' of github.com:GridSpace/grid-apps

This commit is contained in:
Stewart Allen 2021-02-24 12:28:24 -05:00
commit 2fa1bccca8
8 changed files with 39 additions and 19 deletions

View file

@ -1,6 +1,6 @@
{
"name": "grid-apps",
"version": "2.7.11D",
"version": "2.7.12D",
"description": "grid.space 3d slice & modeling tools",
"author": "Stewart Allen <sa@grid.space>",
"license": "MIT",

View file

@ -6,7 +6,7 @@
if (!self.kiri) {
self.kiri = {
beta: 2711,
beta: 2712,
driver: {}, // driver modules
loader: [] // module loading: array of functions
};

View file

@ -14,8 +14,8 @@ let KIRI = self.kiri = self.kiri || {},
seqid = 1,
syncd = {},
running = {},
slicing = {},
worker = null
worker = null,
restarting = false
// occ = new Worker("/kiri/ext/occ-worker.js", {type:"module"}),
;
@ -57,25 +57,34 @@ KIRI.work = {
}
},
isSlicing: function() {
isBusy: function() {
let current = 0;
for (let key in slicing) {
current++;
for (let rec of Object.values(running)) {
if (rec.fn) current++;
}
return current > 0;
},
restart: function() {
// prevent re-entry from cancel callback
if (restarting) {
return;
}
if (worker) {
worker.terminate();
}
// for (let key in slicing) {
// slicing[key]({error: "cancelled slicing"});
// }
restarting = true;
for (let key in running) {
let rec = running[key];
if (rec.fn) {
rec.fn({error: "cancelled operation"});
}
}
syncd = {};
slicing = {};
running = {};
worker = KIRI.work.newWorker();
@ -95,6 +104,8 @@ KIRI.work = {
onreply(reply.data, reply);
};
restarting = false;
},
decimate: function(vertices, options, callback) {
@ -169,14 +180,12 @@ KIRI.work = {
},
slice: function(settings, widget, callback) {
slicing[widget.id] = callback;
send("slice", {
id: widget.id,
settings: settings
}, function(reply) {
callback(reply);
if (reply.done || reply.error) {
delete slicing[widget.id];
// in belt mode, slicing modifies a widget and requires re-sync
if (settings.device.bedBelt) {
widget.modified = true;

View file

@ -242,7 +242,8 @@
// hide all dialogs
API.dialog.hide();
// cancel slicing
if (KIRI.work.isSlicing()) KIRI.work.restart();
API.function.cancel();
// if (KIRI.work.isSlicing()) KIRI.work.restart();
// kill any poppers in compact mode
UC.hidePoppers();
// and send an event (used by FDM client)

View file

@ -918,7 +918,9 @@
}
function cancelWorker() {
if (KIRI.work.isSlicing()) KIRI.work.restart();
if (KIRI.work.isBusy()) {
KIRI.work.restart();
}
}
function showSlider() {

View file

@ -3,7 +3,7 @@
let terms = {
COPYRIGHT: "Copyright (C) Stewart Allen <sa@grid.space> - All Rights Reserved",
LICENSE: "See the license.md file included with the source distribution",
VERSION: "2.7.D11"
VERSION: "2.7.D12"
};
if (typeof(module) === 'object') {

View file

@ -109,6 +109,10 @@
let { tshadow, shadowTop, ztOff, zBottom, zMax } = state;
let { process, stock } = settings;
if (op.down <= 0) {
throw `invalid step down "${op.down}"`;
}
let roughIn = op.inside;
let roughTop = op.top;
let roughDown = op.down;
@ -390,6 +394,10 @@
let { updateToolDiams, zThru, zBottom, shadowTop, tabs, cutTabs, cutPolys } = state;
let { process, stock } = settings;
if (op.down <= 0) {
throw `invalid step down "${op.down}"`;
}
let toolDiam = this.toolDiam = new CAM.Tool(settings, op.tool).fluteDiameter();
updateToolDiams(toolDiam);
@ -453,7 +461,7 @@
tops = tshadow;
}
if (op.omitthru) {
if (op.outside && op.omitthru) {
// eliminate thru holes from shadow
for (let hole of thruHoles) {
for (let top of tops) {

View file

@ -68,7 +68,7 @@
offset = process.outputBrimOffset || (process.outputRaft ? 4 : 0);
// compute first brim
widgets.forEach(function(widget) {
widgets.filter(w => w.slices.length).forEach(function(widget) {
let tops = [];
// collect top outer polygons
widget.slices[0].tops.forEach(function(top) {
@ -267,7 +267,7 @@
// generate purge block for given nozzle
function purge(nozzle, track, layer, start, z, using) {
if (extcount < 2) {
if (extcount < 2 || isBelt) {
return start;
}
let rec = track[nozzle];