add bubbles infill

This commit is contained in:
Stewart Allen 2020-04-20 21:04:52 -04:00
commit d93fd62485
3 changed files with 44 additions and 5 deletions

View file

@ -19,7 +19,8 @@ var gs_kiri_fill = exports;
grid: fillGrid,
gyroid: fillGyroid,
triangle: fillTriangle,
linear: fillLinear
linear: fillLinear,
bubbles: fillBubbles
},
CACHE = self.kiri.fill_fixed = {
hex: fillHexFull,
@ -217,5 +218,42 @@ var gs_kiri_fill = exports;
}
}
function fillBubbles(api) {
let {min, max} = api.bounds();
let slice = api.slice(); // slice object (for adding solids)
let height = api.zHeight(); // layer height
let offset = api.lineWidth() / 2; // offset size by nozzle width
let size = 3 / api.density(); // circle diameter from density
let rad = size / 2 - offset; // max circle radius
let minr = offset + (2 - api.density() * 2) * offset;
let zrep = size / height; // # layers to repeat pattern
let zpad = zrep * 0.3; // # pad layers between pattern
let bind = api.zIndex() % (zrep + zpad); // index into pattern
let brad = bind < zrep ? Math.max(minr,(rad * Math.sin(((bind + 1) / zrep) * Math.PI))) : minr;
let sind = (api.zIndex() + (zrep + zpad)/2) % (zrep + zpad); // index into pattern
let srad = sind < zrep ? Math.max(minr,(rad * Math.sin(((sind + 1) / (zrep + 0)) * Math.PI))) : minr;
for (let x=min.x-size; x<max.x+size; x += size) {
let eoy = 0;
for (let y=min.y-size; y<max.y+size; y += size) {
let xo = (eoy++ % 2 === 0) ? (size / 2) : 0;
// primary pattern
self.base
.newPolygon()
.centerCircle({x:x+xo, y:y*0.85}, brad, 20, true)
.forEachPoint(p => {
api.emit(p.x, p.y);
}, true);
api.newline();
// alternate pattern
self.base
.newPolygon()
.centerCircle({x:x+xo, y:y*0.85+(size/1.75)}, srad, 20, true)
.forEachPoint(p => {
api.emit(p.x, p.y);
}, true);
api.newline();
}
}
};
})();

View file

@ -130,7 +130,8 @@ self.kiri.copyright = exports.COPYRIGHT;
{ name: "grid" },
{ name: "gyroid" },
{ name: "triangle" },
{ name: "linear" }
{ name: "linear" },
{ name: "bubbles" }
],
units: [
{ name: "mm" },

View file

@ -7,10 +7,10 @@
<meta name="keywords" content="3d slicer,slicer,3d slicing,cnc,cam,toolpaths,toolpath generation,kiri,kirimoto,kiri:moto,gcode" />
<meta name="author" content="Stewart Allen">
<meta property="og:description" content="Kiri:Moto is a unique multi-modal 3D slicer that runs entirely in browser and creates output for your favorite maker tools: 3D Printers, CNC Mills and Laser Cutters.">
<meta property="og:title" content="Browser-based Slicer for Makers">
<meta property="og:title" content="Free 3D Tools for Makers">
<meta property="og:type" content="website">
<meta property="og:url" content="https://grid.space/kiri">
<meta property="og:image" content="https://grid.space/img/logo_km_og.png">
<meta property="og:url" content="https://static.grid.space/kiri">
<meta property="og:image" content="https://static.grid.space/img/logo_km_og.png">
<title>Kiri:Moto</title>
<link rel="icon" href="/kiri/favicon.ico">
<link rel="apple-touch-icon" href="/kiri/favicon-mobile.png">