add anti-backlash option for solid fill

This commit is contained in:
Stewart Allen 2018-02-07 23:29:52 -05:00
commit 7ed281972d
4 changed files with 19 additions and 4 deletions

View file

@ -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);

View file

@ -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<lines.length; i++) {
point = lines[i];
if (point.del) continue;
dist = startPoint.distTo2D(point);
dist = origin.distTo2D(point);
list.push({i:i, p:point, d:dist});
}
if (list.length > 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);

View file

@ -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})
});

View file

@ -1,7 +1,7 @@
var exports = {
COPYRIGHT:"Copyright (C) 2014-2017 Stewart Allen <stewart@neuron.com> - 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;