solve remaining object belt rotation and gcode generation issues

This commit is contained in:
Stewart Allen 2021-01-10 22:22:36 -05:00
commit 80e57335a1
5 changed files with 38 additions and 18 deletions

View file

@ -808,7 +808,9 @@
*/
function addPrintPoints(input, output, startPoint, tool) {
if (startPoint && input.length > 0) {
addOutput(output, startPoint, 0, undefined, tool);
lastPoint = startPoint;
// TODO: revisit seek to origin as the first move
// addOutput(output, startPoint, 0, undefined, tool);
}
output.appendAll(input);
}

View file

@ -74,11 +74,21 @@ KIRI.worker = {
let rotation = (Math.PI/180) * (settings.device.bedBelt ? 45 : 0);
if (rotation) {
let bounds = widget.getBoundingBox(true);
// need min y for post-rotation offset in prepare
let vert = widget.vertices;
let miny = Infinity;
for (let i=0, l=vert.length; i<l; ) {
let x = vert[i++];
let y = vert[i++];
let z = vert[i++];
if (z < 0.01) miny = Math.min(miny, y);
}
widget.getBoundingBox(true);
let track = widget.track;
// console.log(widget.id, '\n', track.pos, '\n', track.box, '\n', '\n---\n')
xpos = track.pos.x;
ypos = track.pos.y + settings.device.bedDepth / 2 - track.box.h / 2;
ypos = settings.device.bedDepth / 2 + track.pos.y + miny;
widget.mesh = null;
widget.points = null;
widget.loadVertices(widget.vertices);
@ -112,7 +122,6 @@ KIRI.worker = {
let dy = (wbb.max.y + wbb.min.y)/2;
let dz = wbb.min.z;
widget.rotinfo = { angle: 45, dy, dz, xpos, ypos };
// console.log(widget.id, '\n', widget.belt, '\n', widget.rotinfo, '\n===\n')
send.data({ rotinfo: widget.rotinfo });
}
}