diff --git a/package.json b/package.json index 58916f05..5a2c1c8f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grid-apps", - "version": "2.9.1D", + "version": "2.9.2D", "description": "grid.space 3d slice & modeling tools", "author": "Stewart Allen ", "license": "MIT", diff --git a/src/kiri.js b/src/kiri.js index d6fd80ac..7cd2d958 100644 --- a/src/kiri.js +++ b/src/kiri.js @@ -6,7 +6,7 @@ if (!self.kiri) { self.kiri = { - beta: 2901, + beta: 2902, driver: {}, // driver modules loader: [] // module loading: array of functions }; diff --git a/src/kiri/conf.js b/src/kiri/conf.js index c7119507..a7e01d87 100644 --- a/src/kiri/conf.js +++ b/src/kiri/conf.js @@ -345,6 +345,7 @@ outputLayerRetract: false, outputOriginCenter: true, outputLoopLayers: "", + outputLoops: 0, outputPeelGuard: 0, outputInvertX: false, outputInvertY: false, diff --git a/src/kiri/init.js b/src/kiri/init.js index 413b3a9d..6c4302f6 100644 --- a/src/kiri/init.js +++ b/src/kiri/init.js @@ -1802,7 +1802,8 @@ fdmSep: UC.newBlank({class:"pop-sep", modes:FDM}), outputPeelGuard: UC.newInput(LANG.ag_peel_s, {title:LANG.ag_peel_l, convert:UC.toInt, modes:FDM, comma:true, show:isBelt}), gcodePauseLayers: UC.newInput(LANG.ag_paws_s, {title:LANG.ag_paws_l, modes:FDM, comma:true, show:isNotBelt}), - outputLoopLayers: UC.newInput(LANG.ag_loop_s, {title:LANG.ag_loop_l, modes:FDM, comma:true, show:isBelt}), + // outputLoopLayers: UC.newInput(LANG.ag_loop_s, {title:LANG.ag_loop_l, modes:FDM, comma:true, show:isBelt}), + outputLoops: UC.newInput(LANG.ag_loop_s, {title:LANG.ag_loop_l, convert:UC.toInt, bound:UC.bound(0,1000), modes:FDM, show:isBelt}), outputLayerRetract: UC.newBoolean(LANG.ad_lret_s, onBooleanClick, {title:LANG.ad_lret_l, modes:FDM}), outputPurgeTower: UC.newBoolean(LANG.ad_purg_s, onBooleanClick, {title:LANG.ad_purg_l, modes:FDM, show:isMultiHead}), diff --git a/src/license.js b/src/license.js index 30be2b0a..9bce0ea6 100644 --- a/src/license.js +++ b/src/license.js @@ -3,7 +3,7 @@ let terms = { COPYRIGHT: "Copyright (C) Stewart Allen - All Rights Reserved", LICENSE: "See the license.md file included with the source distribution", - VERSION: "2.9.D1" + VERSION: "2.9.D2" }; if (typeof(module) === 'object') { diff --git a/src/mode/fdm/client.js b/src/mode/fdm/client.js index 601d34a0..47510a8d 100644 --- a/src/mode/fdm/client.js +++ b/src/mode/fdm/client.js @@ -48,6 +48,7 @@ "outputShortPoly": LANG.ad_spol_s, "outputMinSpeed": LANG.ad_mins_s, "outputCoastDist": LANG.ad_scst_s, + "outputLoops": LANG.ag_loop_s, "sliceSupportDensity": LANG.sp_dens_s, "sliceSupportOffset": LANG.sp_offs_s, "sliceLayerStart": LANG.sl_strt_s, diff --git a/src/mode/fdm/export.js b/src/mode/fdm/export.js index 4f6158ad..588bc18d 100644 --- a/src/mode/fdm/export.js +++ b/src/mode/fdm/export.js @@ -33,6 +33,7 @@ extrudeSet = false, time = 0, layer = 0, + layerno = 0, pause = [], pauseCmd = device.gcodePause, output = [], @@ -51,7 +52,8 @@ blast = 0, blastz = 0, process = settings.process, - loops = process.outputLoopLayers, + // loops = process.outputLoopLayers, + loops = process.outputLoops || 0, zhop = process.zHopDistance || 0, // range seekMMM = process.outputSeekrate * 60, retDist = process.outputRetractDist || 0, // range @@ -128,20 +130,41 @@ }); } - if (isBelt && loops) { - loops = loops.split(',').map(range => { - return range.split('-').map(v => parseInt(v)); - }).filter(a => a.length > 1).map(a => { - return { - start: a[0], - end: a[1] ? a[1] + 1 : Infinity, - iter: a[2] >= 0 ? a[2] : 1 - } + // collect loops from ranges and synth range array + let rloops = []; + if (loops > 0) { + rloops.push({ + start: layers[0].slice.index, + end: layers.last().slice.index, + iter: loops - 1 }); } - if (!isBelt || (loops && loops.length < 1)) { - loops = undefined; + for (let range of process.ranges) { + console.log({range}); + if (range.fields.outputLoops) { + rloops.push({ + start: range.lo, + end: range.hi, + iter: range.fields.outputLoops - 1 + }); + } } + loops = isBelt && rloops.length ? rloops : undefined; + + // if (isBelt && loops) { + // loops = loops.split(',').map(range => { + // return range.split('-').map(v => parseInt(v)); + // }).filter(a => a.length > 1).map(a => { + // return { + // start: a[0], + // end: a[1] ? a[1] + 1 : Infinity, + // iter: a[2] >= 0 ? a[2] : 1 + // } + // }); + // } + // if (!isBelt || (loops && loops.length < 1)) { + // loops = undefined; + // } (process.gcodePauseLayers || "").split(",").forEach(function(lv) { let v = parseInt(lv); @@ -333,6 +356,7 @@ while (layer < layers.length) { path = layers[layer]; + layerno = path.slice.index; // range overrides if (path.layer >= 0) { @@ -366,15 +390,17 @@ appendAllSub(pauseCmd) } + let endloop = false; if (loops) { if (inLoop) { - if (layer === inLoop.end) { - append(`M808`); - inLoop = undefined; + if (layerno === inLoop.end) { + endloop = true; + // append(`M808`); + // inLoop = undefined; } } else { for (let loop of loops) { - if (layer === loop.start) { + if (layerno === loop.start) { append(`M808 L${loop.iter}`); if (extrudeAbs) { append(`G92 Z${lout.z.round(decimals)} E${outputLength.round(decimals)}`); @@ -556,6 +582,12 @@ laste = out.emit; } layer++; + + // end open loop when detected + if (endloop) { + append(`M808`); + inLoop = undefined; + } } drainQ(); diff --git a/web/kiri/lang/en.js b/web/kiri/lang/en.js index 496a66fd..75bcd2f7 100644 --- a/web/kiri/lang/en.js +++ b/web/kiri/lang/en.js @@ -597,8 +597,10 @@ kiri.lang['en-us'] = { ag_peel_l: ["starting at this belt z positoin","periodically roll the print off and","back on to the belt to unstick it","and prevent rolling deflection"], ag_paws_s: "pause layers", ag_paws_l: ["comma-separated list of layers","to inject pause commands before"], - ag_loop_s: "loop layers", - ag_loop_l: ["layer ranges to repeat in the format","first-last-count,first-last-count,...","omitted count = 1"], + // ag_loop_s: "loop layers", + // ag_loop_l: ["layer ranges to repeat in the format","first-last-count,first-last-count,...","omitted count = 1"], + ag_loop_s: "loop count", + ag_loop_l: ["number of times to repeat","the selected range or the","entire print if no range"], // SLA MENU sa_menu: "slicing",