diff --git a/notes.md b/notes.md index 400845bd..fc5a2046 100644 --- a/notes.md +++ b/notes.md @@ -11,7 +11,7 @@ * onshape mouse mapping option ## 2.4 -* cnc: tracing, visualization, manual tabs +* cnc: tracing, visualization, manual tabs, auto feature detection (slicing) * fdm: manual supports, continuous printing * all: 2d image to 3d part diff --git a/src/kiri/main.js b/src/kiri/main.js index 60a92217..9d02379b 100644 --- a/src/kiri/main.js +++ b/src/kiri/main.js @@ -1045,7 +1045,6 @@ wb.max.y += wp.y; bounds.union(wb); }); -// console.log(JSON.stringify(bounds)) return settings.bounds = bounds; } @@ -1145,13 +1144,17 @@ } } - function platformLoadSTL(url, onload) { + function platformLoadSTL(url, onload, formdata) { new MOTO.STL().load(url, function(vertices, filename) { - let widget = newWidget().loadVertices(vertices); - widget.filename = filename; - platform.add(widget); - if (onload) onload(vertices, widget); - }) + if (vertices) { + let widget = newWidget().loadVertices(vertices); + widget.filename = filename; + platform.add(widget); + if (onload) { + onload(vertices, widget); + } + } + }, formdata); } function platformComputeMaxZ() { diff --git a/src/kiri/render.js b/src/kiri/render.js index 1ecc2703..3fbc6104 100644 --- a/src/kiri/render.js +++ b/src/kiri/render.js @@ -18,6 +18,10 @@ }; } + getLayer(layer) { + return this.layers[layer]; + } + setLayer(layer, colors, off) { let layers = this.layers; if (typeof(colors) === 'number') { diff --git a/src/kiri/stacks.js b/src/kiri/stacks.js index 8fef07b7..a12b0a95 100644 --- a/src/kiri/stacks.js +++ b/src/kiri/stacks.js @@ -43,6 +43,10 @@ } + function getStack(name) { + return stacks[name]; + } + function create(name, view) { if (stacks[name]) { return stacks[name]; @@ -254,6 +258,7 @@ KIRI.stacks = { clear, create, + getStack, getRange, setRange }; diff --git a/src/mode/cam/client.js b/src/mode/cam/client.js index bded475e..e1ed3794 100644 --- a/src/mode/cam/client.js +++ b/src/mode/cam/client.js @@ -162,7 +162,7 @@ } const {x, y, z} = stock; - if (x && y && z) { + if (x && y && z && !STACKS.getStack('bounds')) { const render = new KIRI.Render().setLayer('bounds', { face: 0xaaaaaa, line: 0xaaaaaa }); const stack = STACKS.create('bounds', SPACE.platform.world); stack.add(render.addPolys([ diff --git a/src/moto/load-stl.js b/src/moto/load-stl.js index b247202f..d1cf502b 100644 --- a/src/moto/load-stl.js +++ b/src/moto/load-stl.js @@ -26,7 +26,7 @@ } - SP.load = function(url, callback) { + SP.load = function(url, callback, formdata) { let stl = this, xhr = new XMLHttpRequest(); @@ -56,9 +56,9 @@ xhr.overrideMimeType('text/plain; charset=x-user-defined'); } - xhr.open('GET', url, true); + xhr.open(formdata ? 'POST' : 'GET', url, true); xhr.responseType = 'arraybuffer'; - xhr.send(null); + xhr.send(formdata); }; SP.encode = function(vertices, normals) {