solve remaining object belt rotation and gcode generation issues
This commit is contained in:
parent
b3595ba8a2
commit
80e57335a1
5 changed files with 38 additions and 18 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 });
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,20 +182,20 @@
|
|||
append(";; " + comment);
|
||||
}
|
||||
let o = [!rate && !newpos.e ? 'G0' : 'G1'];
|
||||
// put out x,y,z in belt mode if not engage/retract
|
||||
let xyz = newpos.x || newpos.y || newpos.z;
|
||||
let emit = { x: xyz && isBelt, y: xyz && isBelt, z: xyz && isBelt };
|
||||
if (typeof newpos.x === 'number') {
|
||||
let emit = { x: false, y: false, z: false };
|
||||
if (typeof newpos.x === 'number' && newpos.x !== pos.x) {
|
||||
pos.x = newpos.x;
|
||||
emit.x = true;
|
||||
}
|
||||
if (typeof newpos.y === 'number') {
|
||||
if (typeof newpos.y === 'number' && newpos.y !== pos.y) {
|
||||
pos.y = newpos.y;
|
||||
emit.y = true;
|
||||
if (isBelt) emit.z = true;
|
||||
}
|
||||
if (typeof newpos.z === 'number') {
|
||||
if (typeof newpos.z === 'number' && newpos.z !== pos.z) {
|
||||
pos.z = newpos.z;
|
||||
emit.z = true;
|
||||
if (isBelt) emit.y = true;
|
||||
}
|
||||
let epos = isBelt ? { x: pos.x, y: pos.y, z: pos.z } : pos;
|
||||
if (isBelt) {
|
||||
|
|
@ -249,11 +249,14 @@
|
|||
(process.firstSliceHeight || process.sliceHeight) : path.height);
|
||||
|
||||
subst.z = zpos = path.z;
|
||||
// subst.z = (zpos + path.height).toFixed(3);
|
||||
subst.Z = subst.z;
|
||||
subst.layer = layer;
|
||||
subst.height = path.height.toFixed(3);
|
||||
|
||||
if (isBelt) {
|
||||
pos.z = zpos;
|
||||
}
|
||||
|
||||
if (pauseCmd && pause.indexOf(layer) >= 0) {
|
||||
appendAllSub(pauseCmd)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@
|
|||
let offset = widget.mesh ? Object.clone(widget.mesh.position) : {x:0, y:0, z:0};
|
||||
if (isBelt) {
|
||||
offset.x = widget.rotinfo.xpos;
|
||||
offset.y = widget.belt.miny;
|
||||
offset.y = -widget.belt.midy;
|
||||
offset.y += widget.rotinfo.ypos * beltfact;
|
||||
offset.z = widget.rotinfo.ypos * beltfact;
|
||||
} else {
|
||||
|
|
@ -385,23 +385,28 @@
|
|||
// alter settings for base extrusions (touching the bed)
|
||||
if (isBelt) {
|
||||
let widget = slice.widget;
|
||||
let lastout, minx = Infinity, maxx = -Infinity, first = false;
|
||||
let lastout, first = false;
|
||||
let minz = Infinity, maxy = -Infinity, minx = Infinity, maxx = -Infinity;
|
||||
let thresh = firstLayerHeight * 1.1;
|
||||
for (let out of tmpout) {
|
||||
let point = out.point;
|
||||
let belty = out.belty = -point.y + point.z * bfactor;
|
||||
if (out.emit && belty < firstLayerHeight && lastout && lastout.belty < firstLayerHeight) {
|
||||
if (out.emit && belty < thresh && lastout && lastout.belty < thresh) {
|
||||
out.speed = firstLayerRate;
|
||||
out.emit *= firstLayerMult;
|
||||
minx = Math.min(minx, point.x, lastout.point.x);
|
||||
maxx = Math.max(maxx, point.x, lastout.point.x);
|
||||
maxy = Math.max(maxy, point.y);
|
||||
minz = Math.min(minz, point.z);
|
||||
first = out;
|
||||
}
|
||||
lastout = out;
|
||||
}
|
||||
// add brim, if specified
|
||||
if (first && firstLayerBrim) {
|
||||
let {emit, tool, point} = first;
|
||||
let {x, y, z} = point;
|
||||
let {emit, tool } = first;
|
||||
let y = maxy;
|
||||
let z = minz;
|
||||
let b = Math.max(firstLayerBrim, 1);
|
||||
print.addOutput(tmpout, newPoint(minx - b, y, z), 0, firstLayerSeek, tool);
|
||||
print.addOutput(tmpout, newPoint(minx - 0, y, z), emit, firstLayerRate, tool);
|
||||
|
|
|
|||
|
|
@ -275,6 +275,7 @@
|
|||
bounds.merge(top.poly.bounds);
|
||||
}
|
||||
widget.belt.miny = -bounds.miny;
|
||||
widget.belt.midy = (bounds.miny + bounds.maxy) / 2;
|
||||
}
|
||||
|
||||
// report slicing complete
|
||||
|
|
|
|||
Loading…
Reference in a new issue