-
Notifications
You must be signed in to change notification settings - Fork 109
/
Copy pathdrilled_cube.scad
51 lines (44 loc) · 1.34 KB
/
drilled_cube.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
width = 70;
joint_h = 2;
level = 4;
reducing_scale = 0.575; // [0:0.707107]
$fn = 8;
module drilled_cube(width, reducing_scale, joint_h, level) {
module drills(width, reducing_scale, joint_h, level) {
w = width * reducing_scale;
r = 1.41421 * w / 2;
if(level > 0) {
z_offset = w / 2 + joint_h;
for(i = [0:3]) {
rotate([i * 90, 0, 0])
translate([0, 0, z_offset])
linear_extrude(width)
circle(r);
}
for(ay = [90, -90]) {
rotate([0, ay, 0])
translate([0, 0, z_offset])
linear_extrude(width)
circle(r);
}
drills(z_offset * 2, reducing_scale, joint_h, level - 1);
}
else {
for(i = [0:3]) {
rotate([i * 90, 0, 0])
linear_extrude(width)
circle(r);
}
for(ay = [90, -90]) {
rotate([0, ay, 0])
linear_extrude(width)
circle(r);
}
}
}
difference() {
cube(width, center = true);
drills(width, reducing_scale, joint_h, level - 1);
}
}
drilled_cube(width, reducing_scale, joint_h, level);