add outer shell first option
This commit is contained in:
parent
c1fdd341f7
commit
228165e021
2 changed files with 13 additions and 9 deletions
|
|
@ -478,6 +478,7 @@ var gs_kiri_print = exports;
|
||||||
firstSpeed = process.firstLayerRate,
|
firstSpeed = process.firstLayerRate,
|
||||||
printSpeed = firstLayer ? firstSpeed : process.outputFeedrate,
|
printSpeed = firstLayer ? firstSpeed : process.outputFeedrate,
|
||||||
moveSpeed = process.outputSeekrate,
|
moveSpeed = process.outputSeekrate,
|
||||||
|
outerFirst = process.outputOuterFirst,
|
||||||
origin = startPoint.add(offset),
|
origin = startPoint.add(offset),
|
||||||
z = slice.z;
|
z = slice.z;
|
||||||
|
|
||||||
|
|
@ -511,14 +512,12 @@ var gs_kiri_print = exports;
|
||||||
startPoint = preout[preout.length - 1].point;
|
startPoint = preout[preout.length - 1].point;
|
||||||
}
|
}
|
||||||
|
|
||||||
function outputTraces(poly, bounds, last) {
|
function outputTraces(poly, bounds, newTop) {
|
||||||
if (!poly) return;
|
if (!poly) return;
|
||||||
if (Array.isArray(poly)) {
|
if (Array.isArray(poly)) {
|
||||||
var lastPoly = null;
|
|
||||||
outputOrderClosest(poly, function(next) {
|
outputOrderClosest(poly, function(next) {
|
||||||
outputTraces(next, bounds, lastPoly);
|
outputTraces(next, bounds);
|
||||||
lastPoly = next;
|
}, null, newTop);
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
var finishShell = poly.depth === 0 && !firstLayer;
|
var finishShell = poly.depth === 0 && !firstLayer;
|
||||||
startPoint = scope.polyPrintPath(poly, startPoint, preout, {
|
startPoint = scope.polyPrintPath(poly, startPoint, preout, {
|
||||||
|
|
@ -661,7 +660,7 @@ var gs_kiri_print = exports;
|
||||||
* @param {Function} fn
|
* @param {Function} fn
|
||||||
* @param {Function} fnp convert 'next' object into a Polygon
|
* @param {Function} fnp convert 'next' object into a Polygon
|
||||||
*/
|
*/
|
||||||
function outputOrderClosest(array, fn, fnp) {
|
function outputOrderClosest(array, fn, fnp, newTop) {
|
||||||
if (array.length === 1) {
|
if (array.length === 1) {
|
||||||
return fn(array[0]);
|
return fn(array[0]);
|
||||||
}
|
}
|
||||||
|
|
@ -674,13 +673,15 @@ var gs_kiri_print = exports;
|
||||||
next = array[i];
|
next = array[i];
|
||||||
if (!next) continue;
|
if (!next) continue;
|
||||||
poly = fnp ? fnp(next) : next;
|
poly = fnp ? fnp(next) : next;
|
||||||
|
if (outerFirst && newTop && poly.depth !== 0) continue;
|
||||||
find = poly.findClosestPointTo(startPoint);
|
find = poly.findClosestPointTo(startPoint);
|
||||||
order.push({
|
order.push({
|
||||||
i: i,
|
i: i,
|
||||||
n: next,
|
n: next,
|
||||||
d: find.distance - (poly.depth * thinWall),
|
d: find.distance - (poly.depth * thinWall * (outerFirst?0:1)),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
newTop = false;
|
||||||
if (order.length === 0) {
|
if (order.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -706,13 +707,13 @@ var gs_kiri_print = exports;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// when skipping between tops, first perform a wipe
|
// when skipping between tops, first perform a wipe
|
||||||
if (lastTop && lastTop !== next && wipe) {
|
if (lastTop && wipe) {
|
||||||
outputWipe(wipe);
|
outputWipe(wipe);
|
||||||
wipe = null;
|
wipe = null;
|
||||||
}
|
}
|
||||||
// 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, !lastTop);
|
||||||
outputFills(next.fill_lines, bounds);
|
outputFills(next.fill_lines, bounds);
|
||||||
outputSparse(next.fill_sparse, bounds);
|
outputSparse(next.fill_sparse, bounds);
|
||||||
if (next.inner) {
|
if (next.inner) {
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,7 @@ self.kiri.license = exports.LICENSE;
|
||||||
outputBrimOffset: 1,
|
outputBrimOffset: 1,
|
||||||
outputShortDistance: 1,
|
outputShortDistance: 1,
|
||||||
outputShortFactor: 1,
|
outputShortFactor: 1,
|
||||||
|
outputOuterFirst: 1,
|
||||||
outputWipeSpeed: 1,
|
outputWipeSpeed: 1,
|
||||||
outputWipeDistance: 1,
|
outputWipeDistance: 1,
|
||||||
outputClockwise: 1,
|
outputClockwise: 1,
|
||||||
|
|
@ -275,6 +276,7 @@ self.kiri.license = exports.LICENSE;
|
||||||
outputBrimOffset: 3,
|
outputBrimOffset: 3,
|
||||||
outputShortDistance: 5.0,
|
outputShortDistance: 5.0,
|
||||||
outputShortFactor: 0.2,
|
outputShortFactor: 0.2,
|
||||||
|
outputOuterFirst: true,
|
||||||
|
|
||||||
// --- LASER ---
|
// --- LASER ---
|
||||||
|
|
||||||
|
|
@ -2360,6 +2362,7 @@ self.kiri.license = exports.LICENSE;
|
||||||
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}),
|
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}),
|
||||||
|
outputOuterFirst: UC.newBoolean("outer first", onBooleanClick, {title: "output outermost shell first", modes:FDM}),
|
||||||
});
|
});
|
||||||
|
|
||||||
function toolUpdate(a,b,c) {
|
function toolUpdate(a,b,c) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue