fixes #72 Z safe distance lifts with multiple objects

This commit is contained in:
Stewart Allen 2020-03-22 21:28:17 -04:00
commit 6c4a81e679
3 changed files with 30 additions and 17 deletions

View file

@ -1252,9 +1252,12 @@ var gs_kiri_cam = exports;
} }
function camOut(point, cut) { function camOut(point, cut) {
let wmx = widget.mesh.position.x;
let wmy = widget.mesh.position.y;
point = point.clone(); point = point.clone();
point.x += widget.mesh.position.x; point.x += wmx;
point.y += widget.mesh.position.y; point.y += wmy;
point.z += zadd; point.z += zadd;
if (nextIsMove) { if (nextIsMove) {
@ -1270,7 +1273,7 @@ var gs_kiri_cam = exports;
isMove = !cut; isMove = !cut;
// drop points too close together // drop points too close together
if (deltaXY < 0.001 && point.z === lastPoint.z) { if (deltaXY < 0.001 && point.z === lastPoint.z) {
// console.trace(["drop dup",lastPoint,point]); console.trace(["drop dup",lastPoint,point]);
return; return;
} }
if (isMove && deltaXY <= toolDiamMove) { if (isMove && deltaXY <= toolDiamMove) {
@ -1291,10 +1294,10 @@ var gs_kiri_cam = exports;
getTopoZPathMax( getTopoZPathMax(
widget, widget,
toolProfile, toolProfile,
lastPoint.x, lastPoint.x - wmx,
lastPoint.y, lastPoint.y - wmy,
point.x, point.x - wmx,
point.y) + zadd, point.y - wmy) + zadd,
point.z, point.z,
lastPoint.z) : zmax, lastPoint.z) : zmax,
mustGoUp = MAX(maxz - point.z, maxz - lastPoint.z) >= tolerance, mustGoUp = MAX(maxz - point.z, maxz - lastPoint.z) >= tolerance,

View file

@ -1,7 +1,7 @@
var exports = { var exports = {
COPYRIGHT:"Copyright (C) Stewart Allen <sa@grid.space> - All Rights Reserved", COPYRIGHT:"Copyright (C) Stewart Allen <sa@grid.space> - All Rights Reserved",
LICENSE:"See the license.md file included with the source distribution", LICENSE:"See the license.md file included with the source distribution",
VERSION:"1.7.7" VERSION:"1.7.8"
}; };
if (!module) var module = {}; if (!module) var module = {};
module.exports = exports; module.exports = exports;

View file

@ -737,7 +737,8 @@ function serveCode(req, res, code) {
********************************************* */ ********************************************* */
let debug = false, let debug = false,
nolocal = false nolocal = false,
procexit = false,
port = 8080, port = 8080,
args = process.argv.slice(2); args = process.argv.slice(2);
@ -1190,13 +1191,18 @@ function open_logger(options) {
function close_file_stream() { function close_file_stream() {
if (logstream) { if (logstream) {
logstream.end(); logstream.end();
logstream.close();
logstream = null; logstream = null;
} }
} }
function emit_log(obj) {
helper.log(obj);
emit(obj);
}
function emit(obj) { function emit(obj) {
if (exiting) { if (exiting) {
// console.log({dir: opt.dir, exiting_skip_log: obj})
return; return;
} }
let next_pattern = moment().format(pattern); let next_pattern = moment().format(pattern);
@ -1216,7 +1222,7 @@ function open_logger(options) {
exits.push(exit); exits.push(exit);
return { emit, close: close_file_stream }; return { emit, log: emit_log, close: close_file_stream };
} }
function processLoad() { function processLoad() {
@ -1230,7 +1236,11 @@ function processLoad() {
} }
function processExit(code) { function processExit(code) {
logger.emit({exit: code, registered: exits.length}); if (procexit) {
return;
}
procexit = true;
logger.log({proc_exit: code, registered: exits.length, uptime: time() - startTime});
while (exits.length) { while (exits.length) {
try { try {
exits.shift()(code); exits.shift()(code);
@ -1238,7 +1248,9 @@ function processExit(code) {
log({on_exit_fail: e}); log({on_exit_fail: e});
} }
} }
process.exit(); setTimeout(() => {
process.exit();
}, 500);
} }
/* ********************************************* /* *********************************************
@ -1316,14 +1328,12 @@ process.on('beforeExit', processExit);
process.on('exit', processExit); process.on('exit', processExit);
process.on('SIGINT', function(sig, code) { process.on('SIGINT', function(sig, code) {
helper.log("caught sigint"); logger.log({exit: code, signal: sig});
logger.emit({signal: sig, code});
processExit(code); processExit(code);
}); });
process.on('SIGHUP', function(sig, code) { process.on('SIGHUP', function(sig, code) {
helper.log("caught sighup"); logger.log({exit: code, signal: sig});
logger.emit({signal: sig, code});
processExit(code); processExit(code);
}); });