diff --git a/js/geo-polygons.js b/js/geo-polygons.js index ab234d86..c690f517 100644 --- a/js/geo-polygons.js +++ b/js/geo-polygons.js @@ -619,6 +619,9 @@ var gs_base_polygons = exports; maxlen = BASE.config.clipper * (maxLen || 0), lines = []; + // store origin as start/affinity point for fill + rayint.origin = newPoint(start.x, start.y, start.z); + for (i = 0; i < steps; i++) { var p1 = newPoint(start.x - raySlope.dx * 1000, start.y - raySlope.dy * 1000, zpos, NOKEY), p2 = newPoint(start.x + raySlope.dx * 1000, start.y + raySlope.dy * 1000, zpos, NOKEY); diff --git a/js/kiri-print.js b/js/kiri-print.js index ed072f35..0e2405df 100644 --- a/js/kiri-print.js +++ b/js/kiri-print.js @@ -496,6 +496,7 @@ var gs_kiri_print = exports; fillSpeed = opt.speed || opt.fillSpeed || (firstLayer ? firstFillSpeed || firstShellSpeed : process.outputFeedrate), moveSpeed = process.outputSeekrate, origin = startPoint.add(offset), + antiBacklash = process.antiBacklash, z = slice.z; // apply first layer extrusion multipliers @@ -566,15 +567,17 @@ var gs_kiri_print = exports; } function outputFills(lines, bounds) { - var mindist, p1, p2, dist, point, find, list, len, lastout, pass = 0; + var mindist, p1, p2, dist, point, find, list, len, lastout, pass = 0, origin; + while (lines) { list = []; mindist = Infinity; + origin = antiBacklash && pass === 0 ? lines.origin : startPoint; // order all points by distance to last point for (i=0; i 0) { @@ -590,10 +593,11 @@ var gs_kiri_print = exports; p2 = lines[find.i - 1]; } + dist = startPoint.distTo2D(p1); + // mark as used (temporary) p1.del = true; p2.del = true; - dist = startPoint.distTo2D(p1); len = p1.distTo2D(p2); // if dist to new segment is less than thinWall @@ -610,6 +614,11 @@ var gs_kiri_print = exports; retract(); } + // anti-backlash take out slack by moving toward origin + if (antiBacklash && dist > retractDist) { + addOutput(preout, p1.add({x:1,y:-1,z:0}), 0, moveSpeed); + } + // bridge ends of fill when they're close together if (dist < thinWall) { addOutput(preout, p1, fillMult, fillSpeed); diff --git a/js/kiri.js b/js/kiri.js index 4a2eb8f1..3e20bb85 100644 --- a/js/kiri.js +++ b/js/kiri.js @@ -100,6 +100,7 @@ self.kiri.license = exports.LICENSE; outputFinishFactor: 1, outputCooling: 1, detectThinWalls: 1, + antiBacklash: 1, outputClockwise: 1, outputOriginCenter: 1, outputInvertX: 1, @@ -307,6 +308,7 @@ self.kiri.license = exports.LICENSE; outputShortFactor: 0.2, outputFinishFactor: 0, detectThinWalls: false, + antiBacklash: false, outputCooling: true, // --- LASER --- @@ -2494,6 +2496,7 @@ self.kiri.license = exports.LICENSE; outputShortDistance: UC.newInput("short segment", {title:"segment length cutoff\nfor short segments\nin millimeters", bound:UC.bound(0,200), convert:UC.toFloat, modes:FDM}), outputShortFactor: UC.newInput("short factor", {title:"max speed reduction factor\nfor short segments\nas % of print speed", bound:UC.bound(0.05,1), convert:UC.toFloat, modes:FDM}), outputFinishFactor: UC.newInput("finish factor", {title:"% of nozzle diameter to\nshorten finish path by\nvalues of 0-1", bound:UC.bound(0.0,1), convert:UC.toFloat, modes:FDM}), + antiBacklash: UC.newBoolean("anti-backlash", onBooleanClick, {title: "use micro-movements to cancel\nbacklash during fills", modes:FDM}), detectThinWalls: UC.newBoolean("thin wall fill", onBooleanClick, {title: "detect and fill thin openings\nbetween shells walls", modes:FDM}) }); diff --git a/js/license.js b/js/license.js index 752303db..c185941a 100644 --- a/js/license.js +++ b/js/license.js @@ -1,7 +1,7 @@ var exports = { COPYRIGHT:"Copyright (C) 2014-2017 Stewart Allen - All Rights Reserved", LICENSE:"Unauthorized copying, modification and re-distribution are strictly prohibited without prior written consent.", - VERSION:"1.0.94" + VERSION:"1.0.95" }; if (!module) var module = {}; module.exports = exports;