aboutsummaryrefslogtreecommitdiff
path: root/parts/shelf_support_below.scad
blob: 022751d7eab071a29ee189a3c5db2b761a3020ef (plain)
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
radius = 12.25;
len = 40;
wall = 4;

screw_radius = 1.5;
screw_head_radius = 2.5;
screw_head_h = 2;

screw_hole_pos = [
   [screw_radius+wall,          -screw_radius-wall,    0],
   [radius*2+wall-screw_radius, -screw_radius-wall,    0],
   [radius*2+wall-screw_radius, len+screw_radius+wall, 0],
   [screw_radius+wall,          len+screw_radius+wall, 0],
];

module screw_hole() {
    union() {
        translate([0, 0, -1])cylinder(r=screw_radius, h=wall+2);
        translate([0, 0, wall-screw_head_h]) 
            cylinder(r1=screw_radius, r2=screw_head_radius, h=screw_head_h+0.1);
    }
}

difference() {
    union() {
        cube([(radius+wall)*2, len, radius+wall]);
        hull() {
            translate(screw_hole_pos[0]) cylinder(r=screw_radius+wall, h=wall);
            translate(screw_hole_pos[2]) cylinder(r=screw_radius+wall, h=wall);
        }
        hull() {
            translate(screw_hole_pos[1]) cylinder(r=screw_radius+wall, h=wall);
            translate(screw_hole_pos[3]) cylinder(r=screw_radius+wall, h=wall);
        }
        translate([screw_radius+wall, -screw_radius-wall, 0]) 
            cube([(radius-screw_radius)*2, screw_radius+wall, wall]);
        translate([screw_radius+wall, len, 0]) 
            cube([(radius-screw_radius)*2, screw_radius+wall, wall]);
    }
    translate([radius+wall, -1, radius+wall]) 
        rotate([-90, 0, 0]) cylinder(r=radius, h=len+2);
    for (i = [0:3]) {
       translate(screw_hole_pos[i]) screw_hole();
    }
}