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

View file

@ -364,6 +364,7 @@ const conf = exports({
outputPurgeTower: 0,
outputBeltFirst: false,
outputAvoidGaps: true,
outputAlternating: false,
outputLayerRetract: false,
outputOriginCenter: true,
outputLoops: 0,

View file

@ -1906,7 +1906,7 @@ gapp.register("kiri.init", [], (root, exports) => {
knifeSep: uc.newBlank({class:"pop-sep", modes:LASER}),
knifeOn: uc.newBoolean(LANG.enable, onBooleanClick, {title:LANG.ou_drkn_l, modes:LASER}),
output: uc.newGroup(LANG.ou_menu, null, {modes:GCODE}),
output: uc.newGroup(LANG.ou_menu, null, {class: "fdmout", modes:GCODE}),
outputLaserPower: uc.newInput(LANG.ou_powr_s, {title:LANG.ou_powr_l, convert:uc.toInt, bound:uc.bound(1,100), modes:LASER}),
outputLaserSpeed: uc.newInput(LANG.ou_sped_s, {title:LANG.ou_sped_l, convert:uc.toInt, modes:LASER}),
laserSep: uc.newBlank({class:"pop-sep", modes:LASER}),
@ -1932,6 +1932,7 @@ gapp.register("kiri.init", [], (root, exports) => {
fdmSep: uc.newBlank({class:"pop-sep", modes:FDM}),
outputLayerRetract: uc.newBoolean(LANG.ad_lret_s, onBooleanClick, {title:LANG.ad_lret_l, modes:FDM}),
outputAvoidGaps: uc.newBoolean(LANG.ad_agap_s, onBooleanClick, {title:LANG.ad_agap_l, modes:FDM}),
outputAlternating: uc.newBoolean(LANG.ad_altr_s, onBooleanClick, {title:LANG.ad_altr_l, modes:FDM}),
outputBeltFirst: uc.newBoolean(LANG.ad_lbir_s, onBooleanClick, {title:LANG.ad_lbir_l, show: isBelt, modes:FDM}),
camConventional: uc.newBoolean(LANG.ou_conv_s, onBooleanClick, {title:LANG.ou_conv_l, modes:CAM}),
camEaseDown: uc.newBoolean(LANG.cr_ease_s, onBooleanClick, {title:LANG.cr_ease_l, modes:CAM}),

View file

@ -67,7 +67,11 @@ class Print {
// fdm & laser
polyPrintPath(poly, startPoint, output, options = {}) {
poly.setClockwise();
if (options.ccw) {
poly.setCounterClockwise();
} else {
poly.setClockwise();
}
const scope = this;
const { settings } = scope;