add export debug event path

This commit is contained in:
Stewart Allen 2021-06-18 15:03:00 -04:00
commit 305066a69a
4 changed files with 32 additions and 1 deletions

View file

@ -228,6 +228,9 @@ KIRI.work = {
if (reply.error) {
ondone(null, reply.error);
}
if (reply.debug) {
KIRI.api.event.emit("export.debug", reply.debug);
}
});
},

View file

@ -249,6 +249,8 @@ KIRI.worker = {
}, function(done) {
// SLA workaround
output = done;
}, function(debug) {
send.data({debug});
});
const { bounds, time, lines, bytes, distance, settings } = current.print;

View file

@ -481,8 +481,33 @@
return func.hoverup();
}
});
api.event.on("export.debug", msg => {
if (msg.arcQ && msg.arcQ.length > 5) {
if (xpdebug) {
xpdebug.destroy();
xpdebug = undefined;
}
let poly = BASE.newPolygon().setOpen();
for (let rec of msg.arcQ) {
poly.addObj(rec);
}
let layers = new KIRI.Layers();
let layer = layers.setLayer("arcq", { line: 0xff00ff, face: 0xff00ff, opacity: 1 });
layer.addPoly(poly, {z:10, thin:true});
xpdebug = new KIRI.Stack(SPACE.platform.world, false);
xpdebug.addLayers(layers);
xpdebug.setVisible(0,Infinity);
xpdebug.show();
console.log(msg, poly);
}
});
}
let xpdebug;
function activeSupports() {
const active = [];
API.widgets.all().forEach(widget => {

View file

@ -13,7 +13,7 @@
/**
* @returns {Array} gcode lines
*/
FDM.export = function(print, online) {
FDM.export = function(print, online, ondone, ondebug) {
let layers = print.output,
settings = FDM.fixExtruders(print.settings),
getRangeParameters = FDM.getRangeParameters,
@ -517,6 +517,7 @@
if (arcDist) {
let rec = {e:out.emit, x, y, z, dist, emitPerMM, speedMMM};
arcQ.push(rec);
// ondebug({arcQ});
let deem = false; // do arcQ[0] and rec have differing emit values?
let depm = false; // do arcQ[0] and rec have differing emit speeds?
let desp = false; // do arcQ[0] and rec have differing move speeds?