-
Notifications
You must be signed in to change notification settings - Fork 1
/
honeycomb.scad
52 lines (47 loc) · 1.15 KB
/
honeycomb.scad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/**
* Honeycomb library
* License: Creative Commons - Attribution
* Copyright: Gael Lafond 2017
* URL: https://www.thingiverse.com/thing:2484395
*
* Inspired from:
* https://www.thingiverse.com/thing:1763704
*/
// a single filled hexagon
module hexagon(l) {
circle(d=l, $fn=6);
}
// parametric honeycomb
module honeycomb(x, y, dia, wall) {
// Diagram
// ______ ___
// / /\ |
// / dia / \ | smallDia
// / / \ _|_
// \ / ____
// \ / /
// ___ \______/ /
// wall | /
// _|_ ______ \
// / \ \
// / \ \
// |---|
// projWall
//
smallDia = dia * cos(30);
projWall = wall * cos(30);
yStep = smallDia + wall;
xStep = dia*3/2 + projWall*2;
difference() {
square([x, y]);
// Note, number of step+1 to ensure the whole surface is covered
for (yOffset = [0:yStep:y+yStep], xOffset = [0:xStep:x+xStep]) {
translate([xOffset, yOffset]) {
hexagon(dia);
}
translate([xOffset + dia*3/4 + projWall, yOffset + (smallDia+wall)/2]) {
hexagon(dia);
}
}
}
}