annotate widget with filename, when available

This commit is contained in:
Stewart Allen 2020-07-30 10:34:12 -04:00
commit 21b0e2b9d5
4 changed files with 20 additions and 6 deletions

View file

@ -17,6 +17,7 @@
* `B` fix adaptive slicing with multi-extruder
* `B` fix supports with grouped parts
* `F` speculative background preview generation
* `F` control for size of purge block (with 0=disabled)
* `F` add separate fill speed control
* `F` manual support addition / control
@ -46,6 +47,7 @@
* `B` fails in pancaking (clone) when there are no sliced layers (like z bottom too high)
* `B` contouring should extend beyond part boundaries by tool radius
* `B` outside cutting direction in roughing mode inverted
* `B` widen outside cuts to prevent chatter on deep (metal) features
* `F` z bounded slices (extension of z bottom offset feature)
* `F` use arcs to connect hard angles
* `F` lead-in milling

View file

@ -1140,16 +1140,19 @@
} else {
ajax(url, function(vertices) {
vertices = js2o(vertices).toFloat32();
platform.add(newWidget().loadVertices(vertices));
if (onload) onload(vertices);
let widget = newWidget().loadVertices(vertices);
platform.add(widget);
if (onload) onload(vertices, widget);
});
}
}
function platformLoadSTL(url, onload) {
new MOTO.STL().load(url, function(vertices) {
platform.add(newWidget().loadVertices(vertices));
if (onload) onload(vertices);
new MOTO.STL().load(url, function(vertices, filename) {
let widget = newWidget().loadVertices(vertices);
widget.filename = filename;
platform.add(widget);
if (onload) onload(vertices, widget);
})
}

View file

@ -295,6 +295,7 @@
PRO.saveToCatalog = function(filename) {
let widget = this;
let time = UTIL.time();
widget.filename = filename;
KIRI.catalog.putFile(filename, this.getGeoVertices(), function(vertices) {
if (vertices && vertices.length) {
console.log("saving decimated mesh ["+vertices.length+"] time ["+(UTIL.time()-time)+"]");

View file

@ -32,7 +32,15 @@
function onloaded (event) {
if (event.target.status === 200 || event.target.status === 0) {
stl.parse(event.target.response || event.target.responseText);
if (callback) callback(stl.vertices);
let cd = xhr.getResponseHeader('Content-Disposition');
if (cd) {
cd = cd.split(';').map(v => v.trim()).filter(v => {
return v.indexOf('filename=') === 0;
}).map(v => {
return v.substring(10,v.length-1);
});
}
if (callback) callback(stl.vertices, cd ? cd[0] : undefined);
} else {
if (callback) callback(null, event.target.statusText);
}