]> www.fi.muni.cz Git - things.git/blob - terarko-podlozka.scad
switch holder.scad
[things.git] / terarko-podlozka.scad
1 infty = 300;
2 eps = 0.01;
3
4 wall = 1.2;
5
6 squares_x = 6;
7 squares_y = 5;
8
9 bottom_l = 8;
10 top_l = 3;
11 top_h = 5;
12 string_h = 1.5;
13 stem_l = 14;
14
15 module stem() {
16         hull() {
17                 cylinder(r = wall/2, h = string_h, $fn = 16);
18                 translate([stem_l, 0, 0])
19                 cylinder(r = wall/2, h = string_h, $fn = 16);
20         }
21         // tip
22         hull() {
23                         cylinder(r = wall/2, h = top_h, $fn = 16);
24                 translate([top_l, 0, 0])
25                         cylinder(r = wall/2, h = top_h, $fn = 16);
26                 translate([bottom_l, 0, 0])
27                         cylinder(r = wall/2, h = string_h, $fn = 16);
28         }
29 }
30
31 module hexagon() {
32         for (angle = [0:120:360]) rotate([0, 0, angle])
33         translate([-stem_l/2, -stem_l*cos(30), 0]) {
34                 stem();
35                 translate([stem_l*(1+sin(30)), stem_l*cos(30), 0])
36                         rotate([0, 0, 240])
37                         stem();
38         }
39 }
40
41
42 for (y = [0:squares_y])
43 for (x = [0:squares_x]) {
44         if (x % 2 == 0) {
45         translate([x/2*stem_l*(2+2*sin(30)), (y+0.5)*stem_l*(2*cos(30)), 0])
46                 hexagon();
47         } else {
48         translate([(x/2)*stem_l*(2+2*sin(30)), y*stem_l*(2*cos(30)), 0])
49                 hexagon();
50         }
51 }