reduce unnecessary retractions

This commit is contained in:
Stewart Allen 2018-01-16 16:01:53 -05:00
commit 0bbbe81ba8
4 changed files with 29 additions and 10 deletions

View file

@ -597,7 +597,7 @@ var gs_kiri_fdm = exports;
}
// update time and distance (should calc in moveTo() instead)
time += (dist / speedMMM) * 60;
time += (dist / speedMMM) * 60 * 1.5;
distance += dist;
progress = Math.round((distance / totaldistance) * 100);

View file

@ -501,6 +501,19 @@ var gs_kiri_print = exports;
if (preout.length) preout.last().retract = true;
}
function intersectsTop(p1, p2) {
var int = false;
slice.tops.forEach(function(top) {
if (!int) top.poly.forEachSegment(function(s1, s2) {
if (UTIL.intersect(p1,p2,s1,s2,BASE.key.SEGINT)) {
int = true;
return int;
}
});
});
return int;
}
function outputTraces(poly, bounds) {
if (!poly) return;
if (Array.isArray(poly)) {
@ -534,7 +547,10 @@ var gs_kiri_print = exports;
var poly = el.poly;
if (poly.last() === point) poly.reverse();
poly.forEachPoint(function(p, i) {
if (i === 0 && lp && lp.distTo2D(p) > retractDistSparse) retract();
// retract if dist trigger and crosses a slice top polygon
if (i === 0 && lp && lp.distTo2D(p) > retractDistSparse && intersectsTop(lp,p)) {
retract();
}
addOutput(preout, p, i === 0 ? 0 : sparseMult, printSpeed);
lp = p;
});
@ -581,7 +597,10 @@ var gs_kiri_print = exports;
addOutput(preout, p2, fillMult * (find.d / thinWall), printSpeed);
lastout = 1;
} else {
if (dist > retractDist) retract();
// retract if dist trigger and crosses a slice top polygon
if (dist > retractDist && intersectsTop(startPoint, p1)) {
retract();
}
// bridge ends of fill when they're close together
if (dist < thinWall) {

View file

@ -263,9 +263,9 @@ self.kiri.license = exports.LICENSE;
sliceSupportEnable: false,
sliceSupportDensity: 0.25,
sliceSupportOffset: 1.0,
sliceSupportSize: 4,
sliceSupportSize: 10,
sliceSupportArea: 1,
sliceSupportExtra: 1,
sliceSupportExtra: 0,
sliceSupportSpan: 6,
sliceSolidMinArea: 0.1,
@ -281,16 +281,16 @@ self.kiri.license = exports.LICENSE;
outputTemp: 220,
outputFanMax: 255,
outputBedTemp: 0,
outputFeedrate: 100,
outputFeedrate: 80,
outputFinishrate: 60,
outputSeekrate: 150,
outputSeekrate: 100,
outputShellMult: 1.1,
outputFillMult: 1.2,
outputSparseMult: 1.3,
outputRetractOver: 5.0,
outputRetractDist: 0.5,
outputRetractSpeed: 20,
outputRetractDwell: 50,
outputRetractSpeed: 40,
outputRetractDwell: 20,
outputBrimCount: 2,
outputBrimOffset: 3,
outputShortPoly: 15.0,

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.87"
VERSION:"1.0.88"
};
if (!module) var module = {};
module.exports = exports;