diff --git a/js/kiri-driver-fdm.js b/js/kiri-driver-fdm.js index 26ef8b25..3e6bf819 100644 --- a/js/kiri-driver-fdm.js +++ b/js/kiri-driver-fdm.js @@ -262,6 +262,9 @@ var gs_kiri_fdm = exports; // raise first layer off raft slightly to lessen adhesion firstLayerHeight += 0.2; + + // retract after last raft layer + output.last().last().retract = true; } // raft excludes brims else @@ -332,6 +335,10 @@ var gs_kiri_fdm = exports; found++; } if (!closest) break; + // retract between widgets + if (layerout.length && minidx !== lastIndex) { + layerout.last().retract = true; + } slices[minidx] = null; closest.offset.z = zoff; // output seek to start point between mesh slices if previous data @@ -340,12 +347,7 @@ var gs_kiri_fdm = exports; printPoint.sub(closest.offset), closest.offset, layerout, - { - // wipe after last layer or between widgets - wipeAfter: (found > 1 && slices.length > 1) || (found === 1 && layer == maxLayers-1), - // only use first layer settings in the absence of a raft - first: closest.slice.index === 0 - } + { first: closest.slice.index === 0 } ); lastIndex = minidx; } @@ -354,6 +356,10 @@ var gs_kiri_fdm = exports; if (layerout.length) output.append(layerout); layer++; update(layer / maxLayers); + // retract after last layer + if (layer === maxLayers) { + layerout.last().retract = true; + } slices = []; layerout = []; diff --git a/js/kiri-print.js b/js/kiri-print.js index d8bf7c8d..b5acae5f 100644 --- a/js/kiri-print.js +++ b/js/kiri-print.js @@ -232,12 +232,13 @@ var gs_kiri_print = exports; newout.push(newlayer); layerout.forEach(function(out) { if (out.point) { - // used for presentation only. can drop non-essential - // data to speed up worker -> browser transfer + // used for renderMoves client side. can drop non-essential + // data to speed up worker -> browser transfer. perhaps a + // more compact encoding (arrays, etc) newlayer.push({ emit: out.emit, speed: out.speed * 60, - // retract: out.retract, + retract: out.retract, point: {x: out.point.x, y: out.point.y, z: out.point.z} }); } @@ -481,8 +482,10 @@ var gs_kiri_print = exports; process = settings.process, nozzle = settings.device.nozzleSize, firstLayer = opt.first || false, - minSeek = nozzle * 1.5, - thinWall = nozzle * 1.75, + minSeek = nozzle * (opt.minSeek || 1.5), + thinWall = nozzle * (opt.thinWall || 1.75), + retractDist = opt.retractOver || 2, + retractDistSparse = opt.retractOverSparse || 5, fillMult = opt.mult || process.outputFillMult, shellMult = opt.mult || process.outputShellMult || (process.laserSliceHeight >= 0 ? 1 : 0), sparseMult = process.outputSparseMult, @@ -525,12 +528,12 @@ var gs_kiri_print = exports; startPoint = preout[preout.length - 1].point; } - function outputTraces(poly, bounds, newTop) { + function outputTraces(poly, bounds) { if (!poly) return; if (Array.isArray(poly)) { outputOrderClosest(poly, function(next) { outputTraces(next, bounds); - }, null, newTop); + }, null); } else { var finishShell = poly.depth === 0 && !firstLayer; startPoint = scope.polyPrintPath(poly, startPoint, preout, { @@ -539,8 +542,8 @@ var gs_kiri_print = exports; shorten: finishShell && !firstLayer ? nozzle * finishFactor : 0, extrude: shellMult, onfirst: function(firstPoint) { - if (startPoint.distTo2D(firstPoint) > 2) retract(); - checkBisect(startPoint, firstPoint, bounds); + if (startPoint.distTo2D(firstPoint) > retractDist) retract(); + // checkBisect(startPoint, firstPoint, bounds); } }); } @@ -591,7 +594,8 @@ var gs_kiri_print = exports; var poly = el.poly; if (poly.last() === point) poly.reverse(); poly.forEachPoint(function(p, i) { - if (i === 0 && lp) checkBisect(lp, p, bounds); + // if (i === 0 && lp) checkBisect(lp, p, bounds); + if (i === 0 && lp && lp.distTo2D(p) > retractDistSparse) retract(); addOutput(preout, p, i === 0 ? 0 : sparseMult, printSpeed); lp = p; }); @@ -638,11 +642,13 @@ var gs_kiri_print = exports; addOutput(preout, p2, fillMult * (find.d / thinWall), printSpeed); lastout = 1; } else { + if (dist > retractDist) retract(); + // check for intersection with bounds and if found // follow the shortest path around that bounding poly - if (bounds && startPoint && dist > minSeek) { - checkBisect(startPoint, p1, bounds); - } + // if (bounds && startPoint && dist > minSeek) { + // checkBisect(startPoint, p1, bounds); + // } // bridge ends of fill when they're close together if (dist < thinWall) { @@ -708,7 +714,6 @@ var gs_kiri_print = exports; } var all = [].appendAll(slice.supports || []).appendAll(slice.tops || []); - var wipe = null; var lastTop = null; outputOrderClosest(all || [], function(next) { if (next instanceof Polygon) { @@ -720,32 +725,17 @@ var gs_kiri_print = exports; outputFills(next.fills, next.inner); } } else { - // when skipping between tops, first perform a wipe - if (lastTop && wipe) { - outputWipe(wipe); - wipe = null; - } // top object var bounds = POLY.flatten(next.gatherOuter([])); - outputTraces([].appendAll(next.traces).appendAll(next.innerTraces() || []), bounds, !lastTop); + outputTraces([].appendAll(next.traces).appendAll(next.innerTraces() || []), bounds); outputFills(next.fill_lines, bounds); outputSparse(next.fill_sparse, bounds); - if (next.inner) { - wipe = next.inner.last(); - } else { - wipe = next.traces.last(); - } lastTop = next; } }, function(obj) { return obj instanceof Polygon ? obj : obj.poly; }); - // perform last wipe on top layer at end of run - if (opt.wipeAfter && wipe) { - outputWipe(wipe); - } - // offset print points for (i=0; i - All Rights Reserved", LICENSE:"Unauthorized copying, modification and re-distribution are strictly prohibited without prior written consent.", - VERSION:"1.0.86" + VERSION:"1.0.87" }; if (!module) var module = {}; module.exports = exports;