diff --git a/release.md b/release.md index 9c002ea7..9d9ce01c 100644 --- a/release.md +++ b/release.md @@ -17,13 +17,14 @@ Full docs @ https://docs.grid.space/projects/kiri-moto * added batch processing to object adds/removes to speedup complex workspace restore * substitute some prusa slicer [variables] with KM {variables} on import -* fix CAM output order for tool changes an spindle speed updates -* add CAM pocket operation using surface selection +* fix CNC output order for tool changes an spindle speed updates +* add CNC pocket operation using surface selection * fix dog-bones on outlines cut by tabs * skip pockets that resolve to null -* fix cnc contour path collision +* fix CNC contour path collision * 10x speedup for true shadow generation -* add gcode feature macros for fdm transitions +* add FDM gcode feature macros for transitions +* add FDM option to alternate shell winding direction ## Mesh:Tool (1.2.0) diff --git a/src/kiri-mode/fdm/client.js b/src/kiri-mode/fdm/client.js index 5114e8b5..de32b8d5 100644 --- a/src/kiri-mode/fdm/client.js +++ b/src/kiri-mode/fdm/client.js @@ -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, diff --git a/src/kiri-mode/fdm/prepare.js b/src/kiri-mode/fdm/prepare.js index 3310c60d..bc73bed4 100644 --- a/src/kiri-mode/fdm/prepare.js +++ b/src/kiri-mode/fdm/prepare.js @@ -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'); diff --git a/src/kiri/conf.js b/src/kiri/conf.js index 76cffb75..f63f51a1 100644 --- a/src/kiri/conf.js +++ b/src/kiri/conf.js @@ -364,6 +364,7 @@ const conf = exports({ outputPurgeTower: 0, outputBeltFirst: false, outputAvoidGaps: true, + outputAlternating: false, outputLayerRetract: false, outputOriginCenter: true, outputLoops: 0, diff --git a/src/kiri/init.js b/src/kiri/init.js index f1bfceec..ac2e32ed 100644 --- a/src/kiri/init.js +++ b/src/kiri/init.js @@ -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}), diff --git a/src/kiri/print.js b/src/kiri/print.js index 15e50776..6d4da5e3 100644 --- a/src/kiri/print.js +++ b/src/kiri/print.js @@ -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; diff --git a/web/kiri/index.css b/web/kiri/index.css index ed24796a..00dc4d3d 100644 --- a/web/kiri/index.css +++ b/web/kiri/index.css @@ -1690,8 +1690,11 @@ th, tr, td, label { .set-pop.xdown { transform: translateY(-25%) !important; } +.set-pop.fdmout { + transform: translateY(-63%) !important; +} .set-pop.fdmadv { - transform: translateY(-75%) !important; + transform: translateY(-74%) !important; } .set-pop.rough { transform: translateY(-14%) !important; diff --git a/web/kiri/lang/en.js b/web/kiri/lang/en.js index ee62476e..9e1321cb 100644 --- a/web/kiri/lang/en.js +++ b/web/kiri/lang/en.js @@ -655,6 +655,8 @@ self.kiri.lang['en-us'] = { ad_abkl_l: ["for better flat surface finish","use micro-movements to cancel","backlash in solid layer output","in millimeters","0 to disable","if your firmware has M425","put that in the gcode header","and leave this as 0"], ad_lbir_s: "belt first", ad_lbir_l: ["always print shells touching the","belt before any other shells"], + ad_altr_s: "alternating", + ad_altr_l: ["alternate shell winding order","clockwise / counter-clockwise"], ad_lret_s: "layer retract", ad_lret_l: ["force filament retraction","between layers"], ad_agap_s: "avoid gaps",