add option to alerntate fdm shell winding order

This commit is contained in:
Stewart Allen 2022-05-10 23:40:25 -04:00
commit a9c6d3132a
8 changed files with 32 additions and 10 deletions

View file

@ -54,6 +54,7 @@ FDM.init = function(kiri, api) {
"outputFillMult": LANG.ou_flml_s,
"outputSparseMult": LANG.ou_spml_s,
"outputRetractWipe": LANG.ad_wpln_s,
"outputAlternating": LANG.ad_altr_s,
"outputShortPoly": LANG.ad_spol_s,
"outputMinSpeed": LANG.ad_mins_s,
"outputCoastDist": LANG.ad_scst_s,

View file

@ -1041,6 +1041,7 @@ function slicePrintPath(print, slice, startPoint, offset, output, opt = {}) {
} else {
let finishShell = poly.depth === 0 && !firstLayer;
startPoint = print.polyPrintPath(poly, startPoint, preout, {
ccw: opt.shell && process.outputAlternating && slice.index % 2,
tool: extruder,
rate: finishShell ? finishSpeed : printSpeed,
accel: finishShell,
@ -1387,14 +1388,22 @@ function slicePrintPath(print, slice, startPoint, offset, output, opt = {}) {
// innermost shells
let inner = next.innerShells() || [];
let shells = next.shells || [];
// alternating winding option
// if (process.outputAlternating || slice.index % 2) {
// console.log({alternating: slice, shells, inner});
// POLY.setWinding(inner, false);
// POLY.setWinding(shells, false);
// }
// output inner polygons
if (shellOrder === 1) outputTraces(inner, { sort: shellOrder });
if (shellOrder === 1) outputTraces(inner, { sort: shellOrder, shell: true });
outputTraces(next.shells, { sort: shellOrder });
outputTraces(shells, { sort: shellOrder, shell: true });
// output outer polygons
if (shellOrder === -1) outputTraces(inner, { sort: shellOrder });
if (shellOrder === -1) outputTraces(inner, { sort: shellOrder, shell: true });
// output thin fill
print.setType('thin fill');