checkpoint belt work

This commit is contained in:
Stewart Allen 2021-01-08 23:44:26 -05:00
commit 8798d060ac
6 changed files with 43 additions and 32 deletions

View file

@ -857,7 +857,7 @@
segtimes[`${segNumber}_draw`] = widget.render(stack);
// rotate stack for belt beds
if (settings.device.bedBelt && widget.rotinfo) {
STACKS.rotate(widget.rotinfo);
stack.obj.rotate(widget.rotinfo);
}
updateSliderMax(true);
setVisibleLayer(-1, 0);
@ -977,9 +977,9 @@
// rotate stack for belt beds
if (settings.device.bedBelt && WIDGETS[0].rotinfo) {
let ri = WIDGETS[0].rotinfo;
console.log({ri})
ri.dy = ri.dz = 0;
STACKS.rotate(WIDGETS[0].rotinfo);
ri.dy = settings.device.bedDepth / 2 - ri.ypos;
stack.obj.rotate(WIDGETS[0].rotinfo);
}
segtimes[`${segNumber}_draw`] = Date.now() - startTime;
}
@ -1685,7 +1685,8 @@
}
if (isBelt) {
let bounds = platformUpdateBounds(), movey = -(dev.bedDepth / 2 + bounds.min.y);
let bounds = platformUpdateBounds(),
movey = -(dev.bedDepth / 2 + bounds.min.y);
forAllWidgets(widget => widget.move(0, movey + 10, 0));
}

View file

@ -288,15 +288,15 @@
});
// recenter for visualization
if (morph && belt) {
for (let layer of output) {
for (let rec of layer) {
let point = rec.point;
point.y -= bounds.min.z;
point.z += bounds.min.y;
}
}
}
// if (false && morph && belt) {
// for (let layer of output) {
// for (let rec of layer) {
// let point = rec.point;
// point.y -= bounds.min.z;
// point.z += bounds.min.y;
// }
// }
// }
scope.imported = gcode;
scope.lines = lines.length;

View file

@ -66,18 +66,22 @@ KIRI.worker = {
let widget = cache[data.id],
last = time(),
ypos,
now;
try {
let rotation = (Math.PI/180) * (settings.device.bedBelt ? 45 : 0);
if (rotation) {
let track = widget.track;
ypos = track.pos.y + settings.device.bedDepth / 2 - track.box.h / 2;
widget.mesh = null;
widget.points = null;
widget.loadVertices(widget.vertices);
widget._rotate(rotation,0,0,true);
widget.center(false, true);
widget.getBoundingBox(true);
widget.belt = { ypos };
}
widget.slice(settings, function(error) {
@ -102,7 +106,7 @@ KIRI.worker = {
let wbb = widget.getBoundingBox(true);
let dy = (wbb.max.y + wbb.min.y)/2;
let dz = wbb.min.z;
widget.rotinfo = { angle: 45, dy, dz };
widget.rotinfo = { angle: 45, dy, dz, ypos };
send.data({ rotinfo: widget.rotinfo });
}
}