add standalone slicing engine / api

This commit is contained in:
Stewart Allen 2020-12-31 23:22:39 -05:00
commit f8c8f73349
5 changed files with 54 additions and 8 deletions

View file

@ -3,15 +3,12 @@
"use strict";
// this code runs in kiri's main loop
if (!self.kiri) self.kiri = {};
let loc = self.location,
let KIRI = self.kiri = self.kiri || {},
loc = self.location,
host = loc.hostname,
port = loc.port,
proto = loc.protocol,
time = function() { return new Date().getTime() },
KIRI = self.kiri,
BASE = self.base,
seqid = 1,
syncd = {},
running = {},

View file

@ -60,9 +60,6 @@
DBUG.enable();
// remove version, preserve other settings
WIN.history.replaceState({},'','/kiri/' + encodeOpt(SETUP) + LOC.hash);
// add show() to catalog for API
CATALOG.show = showCatalog;
@ -446,6 +443,9 @@
STATS.set('init', inits);
STATS.set('kiri', kiri.version);
// remove version from url, preserve other settings
WIN.history.replaceState({},'','/kiri/' + encodeOpt(SETUP) + LOC.hash);
/** ******************************************************************
* Utility Functions
******************************************************************* */

View file

@ -45,6 +45,21 @@
isThin = settings.controller.lineType === "line",
isFlat = settings.controller.lineType === "flat";
// compute bounds if missing
if (!bounds) {
bounds = new THREE.Box3();
for (let widget of widgets) {
let wp = widget.track.pos;
let wb = widget.bounds.clone();
wb.min.x += wp.x;
wb.max.x += wp.x;
wb.min.y += wp.y;
wb.max.y += wp.y;
bounds.union(wb);
}
settings.bounds = bounds;
}
// TODO pick a widget with a slice on the first layer and use that nozzle
// create brim, skirt, raft if specificed in FDM mode (code shared by laser)
if (process.outputBrimCount || process.outputRaft) {