extend stl loading to allow formdata
This commit is contained in:
parent
8a1118d6c1
commit
2c2f954f13
6 changed files with 24 additions and 12 deletions
2
notes.md
2
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
|
||||
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -18,6 +18,10 @@
|
|||
};
|
||||
}
|
||||
|
||||
getLayer(layer) {
|
||||
return this.layers[layer];
|
||||
}
|
||||
|
||||
setLayer(layer, colors, off) {
|
||||
let layers = this.layers;
|
||||
if (typeof(colors) === 'number') {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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([
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue