add novel alternating and overlapping grid infill

This commit is contained in:
Stewart Allen 2020-04-17 19:03:05 -04:00
commit a47c50a7e9
4 changed files with 35 additions and 17 deletions

View file

@ -316,6 +316,7 @@ let gs_kiri_conf = exports;
slaBasePeelDist: 6,
slaBasePeelLiftRate: 1.5,
slaFillDensity: 0,
slaFillLine: 0.5,
slaFirstOffset: 0
}
},

View file

@ -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<end_x; x += step_x) {
fill.push(
BASE.newPolygon().centerRectangle({
x: x * (width/20) - (width/2),
x: x + step_x/2,
y: 0,
z: slice.z
}, width/20, depth/20)
}, linew, depth)
);
}
for (let y=0; y<5; y++) {
if (seq_i % 4 !== 0)
for (let y=start_y; y<end_y; y += step_y) {
fill.push(
BASE.newPolygon().centerRectangle({
x: 0,
y: y * (depth/20) - (depth/2),
y: y + step_y/2,
z: slice.z
}, width/20, depth/20)
}, width, linew)
);
}
let clip = POLY.trimTo(fill, slice.tops.map(t => 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;
}
/**

View file

@ -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) {

View file

@ -1,7 +1,7 @@
var exports = {
COPYRIGHT:"Copyright (C) Stewart Allen <sa@grid.space> - 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;