-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrecursive_cube1.scad
108 lines (90 loc) · 2.73 KB
/
recursive_cube1.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
$fn = 150;
pl = 50; pw =3; ph = pl/8;
plank = [pl,pw,ph];
wn = 0;
corner_radius = 2;
corner_cylinder_height = 8;
s2 = sqrt(2 - 2 * sqrt(2) + 1);
echo ("s2: ", s2);
s3 = 1 - 1/sqrt(2);
echo ("s3: ", s3);
module face(r) {
module plank() {
cube(plank);
}
intersection() {
union() {
plank();
translate([pw,0,0])
rotate([0,0,90])
plank();
translate([pl,0,0])
rotate([0,0,90])
plank();
translate([0,pl-pw,0])
plank();
rotate([0,0,45])
translate([0,-pw/2,0]) {
plank();
translate([pl,-pl/2,ph*s2*0]) rotate([0,0,90]) plank();
if (r > 0) {
translate([(1-s2)*pl,pw/2,0]) scale(s2) face(r-1);
translate([(1-s2)*pl,-s2*pl*0+pw/2,0]) scale(s2) rotate([0,0,270]) face(r-1);
//translate([pl,-pl*s3/2+pw/2,0]) scale(s3) rotate([0,0,0]) %face(r-1);
translate([pl-0.1,pw/2,0]) scale(s3) rotate([0,0,-45]) face(r-1);
//translate([(1-s2)*pl,-s2*pl,0]) rotate([0,0,0]) scale(s2) face(r-1);
}
}
}
translate([corner_radius,corner_radius,-corner_cylinder_height])
minkowski() {
cube([pl-2*corner_radius,pl-2*corner_radius,ph]);
cylinder(r=corner_radius, h=corner_cylinder_height, center=true);
}
}
}
module rounded_cube(side,corner_radius) {
minkowski() {
cube(side-corner_radius);
sphere(corner_radius);
}
}
module waffle_face(n) {
face(n);
// translate([pl,0,0])
// rotate([0,0,90])
// face(n);
// translate([pl,pl,0])
// rotate([0,0,180])
// face(n);
translate([0,pl,0])
rotate([0,0,270])
face(n);
}
module waffle_cube(wn) {
intersection() {
translate([ph,ph,ph])
rounded_cube(pl-ph,ph);
union() {
translate([0,0,ph])
scale([1,1,-1])
waffle_face(wn);
translate([0,0,pl-ph])
waffle_face(wn);
translate([0,ph,0])
rotate([90,0,0])
waffle_face(wn);
translate([0,pl-ph,pl])
rotate([270,0,0])
waffle_face(wn);
translate([pl-ph,0,pl])
rotate([0,90,0])
waffle_face(wn);
translate([ph,0,pl])
rotate([0,90,0])
scale([1,1,-1])
waffle_face(wn);
}
}
}
waffle_cube(wn);