change the way rotation offsets are handled on the belt. appears to fix multi-part + support + anchor causing floating parts
This commit is contained in:
parent
164232e376
commit
fe525b34f2
4 changed files with 18 additions and 25 deletions
|
|
@ -505,6 +505,12 @@
|
||||||
this.center(false);
|
this.center(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
PRO.rotateRaw = function(x, y, z, temp) {
|
||||||
|
this.group.forEach(w => {
|
||||||
|
w._rotate(x, y, z, temp);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
PRO._rotate = function(x, y, z, temp) {
|
PRO._rotate = function(x, y, z, temp) {
|
||||||
if (!temp) {
|
if (!temp) {
|
||||||
this.bounds = null;
|
this.bounds = null;
|
||||||
|
|
|
||||||
|
|
@ -98,10 +98,10 @@ KIRI.worker = {
|
||||||
let x = vert[i++];
|
let x = vert[i++];
|
||||||
let y = vert[i++];
|
let y = vert[i++];
|
||||||
let z = vert[i++];
|
let z = vert[i++];
|
||||||
if (z < 0.01) {
|
// if (z < 0.01) {
|
||||||
miny = Math.min(miny, y);
|
miny = Math.min(miny, y);
|
||||||
maxy = Math.max(maxy, y);
|
maxy = Math.max(maxy, y);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
return { miny, maxy };
|
return { miny, maxy };
|
||||||
}
|
}
|
||||||
|
|
@ -116,19 +116,19 @@ KIRI.worker = {
|
||||||
|
|
||||||
for (let group of Object.values(wgroup)) {
|
for (let group of Object.values(wgroup)) {
|
||||||
let { miny, maxy } = gmin(group);
|
let { miny, maxy } = gmin(group);
|
||||||
|
|
||||||
let widget = group[0];
|
let widget = group[0];
|
||||||
let track = widget.track;
|
let track = widget.track;
|
||||||
let xpos = track.pos.x;
|
let xpos = track.pos.x;
|
||||||
let ypos = settings.device.bedDepth / 2 + track.pos.y + miny;
|
let ypos = settings.device.bedDepth / 2 + track.pos.y + miny;
|
||||||
let rotation = (Math.PI / 180) * 45;
|
let rotation = (Math.PI / 180) * 45;
|
||||||
|
|
||||||
// move to accomodate anchor
|
// move to accomodate anchor
|
||||||
ypos += (settings.process.firstLayerBeltLead || 0);
|
ypos += (settings.process.firstLayerBeltLead || 0);
|
||||||
|
for (let w of group) {
|
||||||
widget.rotate(rotation,0,0,true);
|
w.moveMesh(0, miny, 0);
|
||||||
|
}
|
||||||
|
widget.rotateRaw(rotation,0,0,true);
|
||||||
let minr = gmin(group);
|
let minr = gmin(group);
|
||||||
widget.belt = { xpos, ypos, yadd: minr.maxy - minr.miny };
|
widget.belt = { xpos, ypos, yadd: minr.maxy - minr.miny, dy: -miny, dz: 0 };
|
||||||
for (let others of group.slice(1)) {
|
for (let others of group.slice(1)) {
|
||||||
others.belt = widget.belt;
|
others.belt = widget.belt;
|
||||||
}
|
}
|
||||||
|
|
@ -146,11 +146,8 @@ KIRI.worker = {
|
||||||
let rotation = (Math.PI / 180) * 45;
|
let rotation = (Math.PI / 180) * 45;
|
||||||
for (let group of Object.values(wgroup)) {
|
for (let group of Object.values(wgroup)) {
|
||||||
let widget = group[0];
|
let widget = group[0];
|
||||||
widget.groupBounds();
|
|
||||||
widget.rotate(-rotation,0,0,true);
|
|
||||||
let { dy, dz } = widget.track.center;
|
|
||||||
widget.groupBounds();
|
|
||||||
let { xpos, ypos } = widget.belt;
|
let { xpos, ypos } = widget.belt;
|
||||||
|
let { dy, dz } = widget.belt;
|
||||||
// move to accomodate anchor
|
// move to accomodate anchor
|
||||||
dy -= (settings.process.firstLayerBeltLead || 0) ;
|
dy -= (settings.process.firstLayerBeltLead || 0) ;
|
||||||
widget.rotinfo = { angle: 45, dy, dz, xpos, ypos };
|
widget.rotinfo = { angle: 45, dy, dz, xpos, ypos };
|
||||||
|
|
|
||||||
|
|
@ -305,8 +305,8 @@
|
||||||
let o = rotinfo.ypos * beltfact;
|
let o = rotinfo.ypos * beltfact;
|
||||||
offset = {
|
offset = {
|
||||||
x: rotinfo.xpos,
|
x: rotinfo.xpos,
|
||||||
y: o - belt.midy - belt.yadd/2,
|
y: o,
|
||||||
z: o,
|
z: o
|
||||||
};
|
};
|
||||||
// offset = { x:0, y:0, z:0 };
|
// offset = { x:0, y:0, z:0 };
|
||||||
// locate the lowest point in slices and widget overall
|
// locate the lowest point in slices and widget overall
|
||||||
|
|
@ -322,11 +322,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// todo remove b/c this is now calculated at slice time
|
|
||||||
// flag slices as being on or off the bed / belt
|
|
||||||
// for (let slice of widget.slices) {
|
|
||||||
// slice.onbelt = Math.abs(minby - slice.minby) < 0.01;
|
|
||||||
// }
|
|
||||||
} else {
|
} else {
|
||||||
// when rafts used this is non-zero
|
// when rafts used this is non-zero
|
||||||
offset.z = zoff;
|
offset.z = zoff;
|
||||||
|
|
@ -495,12 +490,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add lead in, when specified
|
|
||||||
// if (process.firstLayerBeltLead) {
|
|
||||||
// // add belt lead in
|
|
||||||
// console.log({process, output});
|
|
||||||
// }
|
|
||||||
|
|
||||||
let thresh = firstLayerHeight * 0.25;
|
let thresh = firstLayerHeight * 0.25;
|
||||||
let seqn = 0;
|
let seqn = 0;
|
||||||
// iterate over layers, find extrusion on belt and
|
// iterate over layers, find extrusion on belt and
|
||||||
|
|
|
||||||
|
|
@ -332,8 +332,9 @@
|
||||||
// also find max width of first 5 layers
|
// also find max width of first 5 layers
|
||||||
let start;
|
let start;
|
||||||
let minx = Infinity, maxx = -Infinity;
|
let minx = Infinity, maxx = -Infinity;
|
||||||
|
let peek = 0;
|
||||||
for (let slice of slices) {
|
for (let slice of slices) {
|
||||||
if (slice.index < 5) {
|
if (slice.groups.length && peek++ < 5) {
|
||||||
for (let poly of slice.topPolys()) {
|
for (let poly of slice.topPolys()) {
|
||||||
minx = Math.min(minx, poly.bounds.minx);
|
minx = Math.min(minx, poly.bounds.minx);
|
||||||
maxx = Math.max(maxx, poly.bounds.maxx);
|
maxx = Math.max(maxx, poly.bounds.maxx);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue