From a47c50a7e97d6da39a5a7032a572d11680426ac9 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Fri, 17 Apr 2020 19:03:05 -0400 Subject: [PATCH] add novel alternating and overlapping grid infill --- js/kiri-conf.js | 1 + js/kiri-driver-sla.js | 42 +++++++++++++++++++++++++++++------------- js/kiri-init.js | 5 +++-- js/license.js | 2 +- 4 files changed, 34 insertions(+), 16 deletions(-) diff --git a/js/kiri-conf.js b/js/kiri-conf.js index 891e4615..0cfae5e8 100644 --- a/js/kiri-conf.js +++ b/js/kiri-conf.js @@ -316,6 +316,7 @@ let gs_kiri_conf = exports; slaBasePeelDist: 6, slaBasePeelLiftRate: 1.5, slaFillDensity: 0, + slaFillLine: 0.5, slaFirstOffset: 0 } }, diff --git a/js/kiri-driver-sla.js b/js/kiri-driver-sla.js index f411e549..04f0dc9d 100644 --- a/js/kiri-driver-sla.js +++ b/js/kiri-driver-sla.js @@ -112,7 +112,7 @@ let gs_kiri_sla = exports; slice.solids.unioned = slice.gatherTopPolys([]); }) } - if (process.slaFillDensity) { + if (process.slaFillDensity && process.slaShell) { forSlices(slices, 0.9, 1.0, (slice) => { fillPolys(slice, settings); }); @@ -126,37 +126,53 @@ let gs_kiri_sla = exports; function fillPolys(slice, settings) { let process = settings.process, device = settings.device, - density = process.slaFillDensity, polys = slice.solids.unioned, bounds = settings.bounds, width = bounds.max.x - bounds.min.x, depth = bounds.max.y - bounds.min.y, - fill = []; + max = Math.max(width,depth), + seq = Math.round(process.slaFillLine / process.slaSlice), + linew = process.slaFillLine, + units_w = (width / linew) * process.slaFillDensity, + units_d = (depth / linew) * process.slaFillDensity, + step_x = width / units_w, + step_y = depth / units_d, + start_x = -(width / 2), + start_y = -(depth / 2), + end_x = width / 2, + end_y = depth / 2, + fill = [] + ; - for (let x=0; x<5; x++) { + let seq_i = Math.floor(slice.index / seq); + + if (seq_i % 4 !== 2) + for (let x=start_x; x t.poly)); - let union = slice.solids.unioned.appendAll(clip); + fill = POLY.union(fill); + fill = POLY.trimTo(fill, slice.tops.map(t => t.poly)); + fill = POLY.union(slice.solids.unioned.appendAll(fill)); - slice.solids.unioned = POLY.union(union); - // console.log(slice.index, clip, union, slice.solids.unioned); + slice.solids.unioned = fill; } /** diff --git a/js/kiri-init.js b/js/kiri-init.js index bd2866e1..118b5008 100644 --- a/js/kiri-init.js +++ b/js/kiri-init.js @@ -1289,7 +1289,7 @@ var gs_kiri_init = exports; layers: UC.setGroup($("layers")), layerOutline: UC.newBoolean(LANG.la_olin, onLayerToggle, {modes:LOCAL ? ALL : FDM_LASER}), - layerTrace: UC.newBoolean(LANG.la_trce, onLayerToggle, {modes:FDM_LASER_SLA}), + layerTrace: UC.newBoolean(LANG.la_trce, onLayerToggle, {modes:FDM_LASER}), layerFacing: UC.newBoolean(LANG.la_face, onLayerToggle, {modes:CAM}), layerRough: UC.newBoolean(LANG.la_ruff, onLayerToggle, {modes:CAM}), layerFinish: UC.newBoolean(LANG.la_fini, onLayerToggle, {modes:CAM}), @@ -1301,7 +1301,7 @@ var gs_kiri_init = exports; layerSparse: UC.newBoolean(LANG.la_sprs, onLayerToggle, {modes:FDM}), layerSupport: UC.newBoolean(LANG.la_sprt, onLayerToggle, {modes:FDM}), layerPrint: UC.newBoolean(LANG.la_prnt, onLayerToggle), - layerMoves: UC.newBoolean(LANG.la_move, onLayerToggle), + layerMoves: UC.newBoolean(LANG.la_move, onLayerToggle, {modes:GCODE}), settingsGroup: UC.newGroup(LANG.se_menu, control, {region:"right"}), settingsTable: UC.newTableRow([ @@ -1476,6 +1476,7 @@ var gs_kiri_init = exports; slaFill: UC.newGroup('infill', null, {modes:SLA, group:"sla-first"}), slaFillDensity: UC.newInput('density', {title:'percent infill\n0.0-1.0', convert:UC.toFloat, bound:UC.bound(0,1), modes:SLA}), + slaFillLine: UC.newInput('line width', {title:'hatch line width\nin millimeters', convert:UC.toFloat, bound:UC.bound(0,5), modes:SLA}), }); if (!lang_set) { diff --git a/js/license.js b/js/license.js index 27b63114..4227eaf0 100644 --- a/js/license.js +++ b/js/license.js @@ -1,7 +1,7 @@ var exports = { COPYRIGHT:"Copyright (C) Stewart Allen - All Rights Reserved", LICENSE:"See the license.md file included with the source distribution", - VERSION:"1.8.8" + VERSION:"1.8.9" }; if (!module) var module = {}; module.exports = exports;