diff --git a/notes.md b/notes.md index 4fd36500..e030670e 100644 --- a/notes.md +++ b/notes.md @@ -86,3 +86,7 @@ * http://wiki.imal.org/howto/cnc-milling-introduction-cutting-tools * http://www.twak.co.uk/2011/01/degeneracy-in-weighted-straight.html * http://photon.chrisgraf.de/ + +# More CNC + +* https://www.researchgate.net/publication/250328721_Toolpath_Optimization_on_Automatic_Removal_Uncut_and_Application diff --git a/src/geo/polygons.js b/src/geo/polygons.js index 32bf07b6..2c6012fb 100644 --- a/src/geo/polygons.js +++ b/src/geo/polygons.js @@ -531,7 +531,7 @@ let circ1 = sumCirc(orig), circ2 = sumCirc(polys), diff = Math.abs(1 - (circ1 / circ2)); - + // if circularity of original and offset differ, possible wall gaps if (diff > 0.2) { thins(orig, out.length ? polys : null, diff, -over); } diff --git a/src/kiri/init.js b/src/kiri/init.js index 96177fc6..75709b76 100644 --- a/src/kiri/init.js +++ b/src/kiri/init.js @@ -1512,8 +1512,8 @@ zHopDistance: UC.newInput(LANG.ad_zhop_s, {title:LANG.ad_zhop_l, bound:UC.bound(0,3.0), convert:UC.toFloat, modes:FDM, expert:true}), antiBacklash: UC.newInput(LANG.ad_abkl_s, {title:LANG.ad_abkl_l, bound:UC.bound(0,3), convert:UC.toInt, modes:FDM, expert:true}), sliceRotation: LOCAL ? UC.newInput(LANG.ad_slrt_s, {title:LANG.ad_slrt_l, bound:UC.bound(-45,45), convert:UC.toFloat, modes:FDM, expert:true}) : null, - // detectThinWalls: UC.newBoolean("thin wall fill", onBooleanClick, {title: "detect and fill thin openings\nbetween shells walls", modes:FDM, expert:true}) gcodePauseLayers: UC.newInput(LANG.ag_paws_s, {title:LANG.ag_paws_l, modes:FDM, expert:true, comma:true}), + detectThinWalls: LOCAL ? UC.newBoolean(LANG.ad_thin_s, onBooleanClick, {title: LANG.ad_thin_l, modes:FDM, expert:true}) : null, outputLayerRetract: UC.newBoolean(LANG.ad_lret_s, onBooleanClick, {title:LANG.ad_lret_l, modes:FDM, expert:true}), // SLA diff --git a/src/kiri/slice.js b/src/kiri/slice.js index afaa8b4f..b3f00249 100644 --- a/src/kiri/slice.js +++ b/src/kiri/slice.js @@ -358,20 +358,21 @@ } if (count) { - // permit offset of 0 for laser + // permit offset of 0 for laser and drag knife if (offset1 === 0 && count === 1) { last = top_poly.clone(true); top.traces = last; } else { if (opt.thin) { + // thin wall offset strategy let on1s2 = offset1 * 2, on2s2 = offsetN * 2; POLY.expand2( - top_poly, - -offset1, - -offsetN, - top.traces, - count, + top_poly, // reference polygon(s) + -offset1, // first inset distance + -offsetN, // subsequent inset distnace + top.traces, // accumulator array + count, // numberof insets to perform // on each new offset trace ... function(polys, countNow) { last = polys; @@ -385,6 +386,10 @@ }); }, // thin wall probe + // p1 = original polys + // p2 = collected polys + // diff = circularity difference + // dist = over-expansion distance function(p1, p2, diff, dist) { if (p2) { // nth offset @@ -405,13 +410,14 @@ }, z); } else { + // standard wall offsetting strategy POLY.expand( - top_poly, - -offset1, - z, - top.traces, - count, - -offsetN, + top_poly, // reference polygon(s) + -offset1, // first inset distance + z, // set new polys to this z + top.traces, // accumulator array + count, // number of insets to perform + -offsetN, // subsequent inset distance // on each new offset trace ... function(polys, countNow) { last = polys; @@ -427,6 +433,7 @@ } } } else { + // no shells, just infill, is permitted last = [top.poly]; } diff --git a/src/mode/fdm/driver.js b/src/mode/fdm/driver.js index 8ce1e85d..0897acf2 100644 --- a/src/mode/fdm/driver.js +++ b/src/mode/fdm/driver.js @@ -172,7 +172,7 @@ ) && !vaseMode; slice.doShells(spro.sliceShells, firstOffset, shellOffset, fillOffset, { vase: vaseMode, - thin: false && spro.detectThinWalls + thin: spro.detectThinWalls }); if (solid) slice.doSolidLayerFill(fillSpacing, sliceFillAngle); sliceFillAngle += 90.0; @@ -192,6 +192,11 @@ slice.doThinFill(fillSpacing, sliceFillAngle); sliceFillAngle += 90.0; }, "solids"); + } else if (spro.detectThinWalls) { + forSlices(0.35, 0.5, function(slice) { + slice.doThinFill(fillSpacing, sliceFillAngle); + sliceFillAngle += 90.0; + }, "thins"); } // calculations only relevant when supports are enabled diff --git a/web/kiri/lang/en.js b/web/kiri/lang/en.js index fc207937..420b2876 100644 --- a/web/kiri/lang/en.js +++ b/web/kiri/lang/en.js @@ -427,6 +427,8 @@ kiri.lang['en-us'] = { ad_zhop_l: "amount to raise z\non retraction moves\nin millimeters\n0 to disable", ad_abkl_s: "anti-backlash", ad_abkl_l: "use micro-movements to cancel\nbacklash during fills\nin millimeters", + ad_thin_s: "thin walls", + ad_thin_l: "detect and fill gaps\nbetween shell walls", ad_slrt_s: "slice rotation", ad_slrt_l: "slice object on a bias\nangle in the y axis.\nuseful for extremely\nlarge format prints", ad_lret_s: "layer retract",