diff --git a/src/kiri/print.js b/src/kiri/print.js index b45fab6a..e1b35ef7 100644 --- a/src/kiri/print.js +++ b/src/kiri/print.js @@ -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); } diff --git a/src/kiri/worker.js b/src/kiri/worker.js index 8ebf74e4..0d399c46 100644 --- a/src/kiri/worker.js +++ b/src/kiri/worker.js @@ -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= 0) { appendAllSub(pauseCmd) } diff --git a/src/mode/fdm/prepare.js b/src/mode/fdm/prepare.js index 6aebf308..75d45e10 100644 --- a/src/mode/fdm/prepare.js +++ b/src/mode/fdm/prepare.js @@ -292,9 +292,9 @@ 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; + offset.z = widget.rotinfo.ypos * beltfact; } else { // when rafts used this is non-zero offset.z = zoff; @@ -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); diff --git a/src/mode/fdm/slice.js b/src/mode/fdm/slice.js index 65b776a8..994583fa 100644 --- a/src/mode/fdm/slice.js +++ b/src/mode/fdm/slice.js @@ -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