reimagine wipe functionality
This commit is contained in:
parent
76eeb43b5c
commit
98a34c9826
3 changed files with 44 additions and 9 deletions
|
|
@ -447,21 +447,26 @@ var gs_kiri_fdm = exports;
|
||||||
moveTo({x:x, y:y, e:emitMM}, outMMM);
|
moveTo({x:x, y:y, e:emitMM}, outMMM);
|
||||||
emitted += emitMM;
|
emitted += emitMM;
|
||||||
} else {
|
} else {
|
||||||
|
var moveMMM = seekMMM;
|
||||||
|
// usually wipe speed override
|
||||||
|
if (out.speed) {
|
||||||
|
moveMMM = out.speed * 60;
|
||||||
|
}
|
||||||
if (laste && retOver > 0.0 && dist > retOver) {
|
if (laste && retOver > 0.0 && dist > retOver) {
|
||||||
//
|
//
|
||||||
moveTo({e:-retDist}, retSpeed, "ooze retract");
|
moveTo({e:-retDist}, retSpeed, "ooze retract");
|
||||||
moveTo({x:x, y:y}, seekMMM);
|
moveTo({x:x, y:y}, moveMMM);
|
||||||
moveTo({e:retDist}, retSpeed, "re-engage");
|
moveTo({e:retDist}, retSpeed, "re-engage");
|
||||||
} else if (lastp && dist <= fillBridgeDist) {
|
} else if (lastp && dist <= fillBridgeDist) {
|
||||||
var e = (layer === 0 ? emitPerMMLayer1 : emitPerMM) * dist;
|
var e = (layer === 0 ? emitPerMMLayer1 : emitPerMM) * dist;
|
||||||
moveTo({x:x, y:y, e:e}, outMMM);
|
moveTo({x:x, y:y, e:e}, outMMM);
|
||||||
} else {
|
} else {
|
||||||
moveTo({x:x, y:y}, seekMMM);
|
moveTo({x:x, y:y}, moveMMM);
|
||||||
}
|
}
|
||||||
time += (dist / seekMMM) * 60; // seek distance
|
time += (dist / moveMMM) * 60; // seek distance
|
||||||
time += (retDist / retSpeed) * 60 * 2; // retraction time
|
time += (retDist / retSpeed) * 60 * 2; // retraction time
|
||||||
// approximate compensation for acceleration & deceleration
|
// approximate compensation for acceleration & deceleration
|
||||||
time += (shortDist * 2) / seekMMM / 10 * 60;
|
time += (shortDist * 2) / moveMMM / 10 * 60;
|
||||||
}
|
}
|
||||||
lastp = out.point;
|
lastp = out.point;
|
||||||
laste = out.emit;
|
laste = out.emit;
|
||||||
|
|
|
||||||
|
|
@ -326,9 +326,7 @@ var gs_kiri_print = exports;
|
||||||
PRO.polyPrintPath = function(poly, startPoint, output, extrude, onfirst) {
|
PRO.polyPrintPath = function(poly, startPoint, output, extrude, onfirst) {
|
||||||
poly.setClockwise();
|
poly.setClockwise();
|
||||||
|
|
||||||
var mindist = Infinity,
|
var closest = poly.findClosestPointTo(startPoint),
|
||||||
closest = poly.findClosestPointTo(startPoint),
|
|
||||||
dist,
|
|
||||||
first = true,
|
first = true,
|
||||||
settings = this.settings,
|
settings = this.settings,
|
||||||
shellMult = extrude || settings.process.outputShellMult,
|
shellMult = extrude || settings.process.outputShellMult,
|
||||||
|
|
@ -368,9 +366,35 @@ var gs_kiri_print = exports;
|
||||||
fillMult = process.outputFillMult,
|
fillMult = process.outputFillMult,
|
||||||
shellMult = process.outputShellMult || (process.laserSliceHeight >= 0 ? 1 : 0),
|
shellMult = process.outputShellMult || (process.laserSliceHeight >= 0 ? 1 : 0),
|
||||||
sparseMult = process.outputSparseMult,
|
sparseMult = process.outputSparseMult,
|
||||||
|
wipeDistance = process.outputWipeDistance,
|
||||||
|
wipeSpeed = process.outputWipeSpeed || 20,
|
||||||
origin = startPoint.add(offset),
|
origin = startPoint.add(offset),
|
||||||
z = slice.z;
|
z = slice.z;
|
||||||
|
|
||||||
|
function outputWipe(poly) {
|
||||||
|
var closest = poly.findClosestPointTo(startPoint),
|
||||||
|
distance = wipeDistance,
|
||||||
|
last = startPoint;
|
||||||
|
|
||||||
|
if (!distance) return;
|
||||||
|
|
||||||
|
while (distance > 0) poly.forEachPoint(function(point) {
|
||||||
|
if (distance > 0) {
|
||||||
|
var len = last.distTo2D(point);
|
||||||
|
if (len > distance) {
|
||||||
|
addOutput(preout, point.offsetPointFrom(last, distance), 0, wipeSpeed);
|
||||||
|
distance = 0;
|
||||||
|
} else {
|
||||||
|
addOutput(preout, point, 0, wipeSpeed);
|
||||||
|
distance -= last.distTo2D(point);
|
||||||
|
}
|
||||||
|
last = point;
|
||||||
|
}
|
||||||
|
}, true, closest.index);
|
||||||
|
|
||||||
|
startPoint = preout[preout.length - 1].point;
|
||||||
|
}
|
||||||
|
|
||||||
function outputTraces(poly, bounds) {
|
function outputTraces(poly, bounds) {
|
||||||
if (!poly) return;
|
if (!poly) return;
|
||||||
if (Array.isArray(poly)) {
|
if (Array.isArray(poly)) {
|
||||||
|
|
@ -522,10 +546,10 @@ var gs_kiri_print = exports;
|
||||||
} else {
|
} else {
|
||||||
// top object
|
// top object
|
||||||
var bounds = POLY.flatten(next.gatherOuter([]));
|
var bounds = POLY.flatten(next.gatherOuter([]));
|
||||||
// outputTraces([].appendAll(next.traces).appendAll(next.innerTraces() || []), bounds);
|
outputTraces([].appendAll(next.traces).appendAll(next.innerTraces() || []), bounds);
|
||||||
outputTraces([].appendAll(next.innerTraces() || []).appendAll(next.traces), bounds);
|
|
||||||
outputFills(next.fill_lines, bounds);
|
outputFills(next.fill_lines, bounds);
|
||||||
outputSparse(next.fill_sparse, bounds);
|
outputSparse(next.fill_sparse, bounds);
|
||||||
|
outputWipe(next.traces.last());
|
||||||
}
|
}
|
||||||
}, function(obj) {
|
}, function(obj) {
|
||||||
return obj instanceof Polygon ? obj : obj.poly;
|
return obj instanceof Polygon ? obj : obj.poly;
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,8 @@ self.kiri.license = exports.LICENSE;
|
||||||
outputBrimOffset: 1,
|
outputBrimOffset: 1,
|
||||||
outputShortDistance: 1,
|
outputShortDistance: 1,
|
||||||
outputShortFactor: 1,
|
outputShortFactor: 1,
|
||||||
|
outputWipeSpeed: 1,
|
||||||
|
outputWipeDistance: 1,
|
||||||
outputClockwise: 1,
|
outputClockwise: 1,
|
||||||
outputOriginCenter: 1,
|
outputOriginCenter: 1,
|
||||||
outputInvertX: 1,
|
outputInvertX: 1,
|
||||||
|
|
@ -269,6 +271,8 @@ self.kiri.license = exports.LICENSE;
|
||||||
outputRetractOver: 5.0,
|
outputRetractOver: 5.0,
|
||||||
outputRetractDist: 0.5,
|
outputRetractDist: 0.5,
|
||||||
outputRetractSpeed: 20,
|
outputRetractSpeed: 20,
|
||||||
|
outputWipeSpeed: 20,
|
||||||
|
outputWipeDistance: 0,
|
||||||
outputBrimCount: 2,
|
outputBrimCount: 2,
|
||||||
outputBrimOffset: 3,
|
outputBrimOffset: 3,
|
||||||
outputShortDistance: 5.0,
|
outputShortDistance: 5.0,
|
||||||
|
|
@ -2349,6 +2353,8 @@ self.kiri.license = exports.LICENSE;
|
||||||
outputRetractOver: UC.newInput("retract over", {title:"retract filament for\nnon-print moves\nover this distance\n0 = disable", convert:UC.toFloat, modes:FDM}),
|
outputRetractOver: UC.newInput("retract over", {title:"retract filament for\nnon-print moves\nover this distance\n0 = disable", convert:UC.toFloat, modes:FDM}),
|
||||||
outputRetractDist: UC.newInput("retract dist", {title:"amount to retract filament", convert:UC.toFloat, modes:FDM}),
|
outputRetractDist: UC.newInput("retract dist", {title:"amount to retract filament", convert:UC.toFloat, modes:FDM}),
|
||||||
outputRetractSpeed: UC.newInput("retract rate", {title:"speed of filament\nretraction in mm/s", convert:UC.toInt, modes:FDM}),
|
outputRetractSpeed: UC.newInput("retract rate", {title:"speed of filament\nretraction in mm/s", convert:UC.toInt, modes:FDM}),
|
||||||
|
outputWipeSpeed: UC.newInput("wipe speed", {title:"speed while wiping\nnozzle in mm/s", convert:UC.toInt, modes:FDM}),
|
||||||
|
outputWipeDistance: UC.newInput("wipe distance", {title:"distance to wipe nozzle after\neach enclosed island completes\nin millimeters. 0 to disable", convert:UC.toInt, modes:FDM}),
|
||||||
outputShortDistance: UC.newInput("short distance", {title:"segment length cutoff\nfor short segments\nin millimeters", bound:UC.bound(0,200), convert:UC.toFloat, modes:FDM}),
|
outputShortDistance: UC.newInput("short distance", {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}),
|
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}),
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue