checkpoint belt work

This commit is contained in:
Stewart Allen 2021-01-09 19:10:39 -05:00
commit 44d54491d7
6 changed files with 103 additions and 116 deletions

View file

@ -978,9 +978,9 @@
if (settings.device.bedBelt && WIDGETS[0].rotinfo) {
let ri = WIDGETS[0].rotinfo;
// console.log(ri)
ri.dy = ri.dz = 0;
ri.dy = settings.device.bedDepth / 2 - ri.ypos;
stack.obj.rotate(WIDGETS[0].rotinfo);
// ri.dy = ri.dz = 0;
// ri.dy = settings.device.bedDepth / 2 - ri.ypos;
// stack.obj.rotate(WIDGETS[0].rotinfo);
}
segtimes[`${segNumber}_draw`] = Date.now() - startTime;
}
@ -1688,7 +1688,7 @@
if (isBelt) {
let bounds = platformUpdateBounds(),
movey = -(dev.bedDepth / 2 + bounds.min.y);
forAllWidgets(widget => widget.move(0, movey + 10, 0));
forAllWidgets(widget => widget.move(0, movey + 0, 0));
}
platform.update_origin();

View file

@ -100,6 +100,7 @@
const scope = this,
morph = false,
// morph = true,
bounds = scope.bounds = {
max: { x:-Infinity, y:-Infinity, z:-Infinity},
min: { x:Infinity, y:Infinity, z:Infinity}
@ -166,8 +167,8 @@
);
if (morph && belt) {
point.z *= beltfact;
point.y -= point.z * beltfact;
point.z *= beltfact;
}
const retract = (fdm && pos.E < 0) || undefined;
@ -226,16 +227,23 @@
lastPos = Object.assign({}, pos);
}
lines.forEach(function(line) {
lines.forEach(function(line, idx) {
if (idx < 10) console.log({line})
if (line.indexOf(';LAYER:') === 0) {
newlayer = true;
if (idx < 100) console.log({newlayer});
}
if (line.indexOf('- LAYER ') > 0) {
seq.height = defh;
const hd = line.replace('(','').replace(')','').split(' ');
defh = parseFloat(hd[4]);
if (fdm) dz = -defh / 2;
newlayer = true;
if (idx < 100) console.log({layer: defh});
}
if (line.indexOf("BED TYPE: BELT") > 0) {
belt = true;
if (idx < 100) console.log({isbelt: belt});
}
line = line.split(";")[0].split(" ").filter(v => v);
let cmd = line.shift();

View file

@ -74,7 +74,9 @@ KIRI.worker = {
let rotation = (Math.PI/180) * (settings.device.bedBelt ? 45 : 0);
if (rotation) {
let bounds = 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;
widget.mesh = null;
@ -83,7 +85,7 @@ KIRI.worker = {
widget._rotate(rotation,0,0,true);
widget.center(false, true);
widget.getBoundingBox(true);
widget.belt = { ypos };
widget.belt = { xpos, ypos };
}
widget.slice(settings, function(error) {
@ -106,9 +108,11 @@ KIRI.worker = {
widget.setPoints(null);
widget._rotate(-rotation,0,0,true);
let wbb = widget.getBoundingBox(true);
widget.center(false, true);
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 });
}
}