chiark / gitweb /
lock-inframe-bracket: Adjust some thicknesses
[reprap-play.git] / lock-inframe-bracket.scad
1 // -*- C -*-
2
3 tube_dia = 27.5 + 0.5;
4 lock_w = 42.5 + 0.5;
5 lock_d = 28.0 + 0.5;
6 main_h = 45.0;
7 backflange_d = 12;
8
9 lockshaft_r = [5, 5];
10 cliprecess_h = 16;
11 total_h = 45;
12
13 back_gap = 7;
14 main_th = 2.5;
15 midweb_d = 3;
16 clip_th = 2.5;
17 clip_gap = 2.5;
18 clip_d = 22.0;
19
20 mountscrew_dia = 4 + 0.5;
21 clipbolt_dia = 5 + 0.5;
22
23 backflange_th = 3.5;
24
25 // calculated
26
27 front_th = main_th;
28 tube_th = main_th;
29
30 tube_or = tube_dia/2 + tube_th;
31 back_ohw = back_gap/2 + backflange_th;
32 backflange_ymin = tube_or+backflange_d;
33
34 lock_0y = tube_dia/2 + lock_d/2 + midweb_d;
35
36 lock_or = [lock_w, lock_d]/2 + [front_th,front_th];
37
38 module oval(sz){ // sz[0] > sz[1]
39   xr = sz[0];
40   yr = sz[1];
41   hull(){
42     for (sx=[-1,+1]) {
43       translate([sx * (xr-yr), 0])
44         circle(r=yr);
45     }
46   }
47 }
48
49 module MainPlan(){
50   difference(){
51     union(){
52       circle(r = tube_or);
53       translate([-back_ohw,0]) mirror([0,1])
54         square([back_ohw*2, backflange_ymin]);
55     }
56     circle(r = tube_dia/2);
57     translate([-back_gap/2,1]) mirror([0,1])
58       square([back_gap, backflange_ymin+2]);
59   }
60   translate([0, lock_0y]){
61     difference(){
62       union(){
63         oval(lock_or);
64       }
65       oval([lock_w/2, lock_d/2]);
66     }
67   }
68 }
69
70 lockshaft_or = lockshaft_r + [clip_th,clip_th];
71 cliprecess_ymax = cliprecess_h - lockshaft_r[1];
72 clip_ymin = cliprecess_ymax - total_h;
73 clip_ogap = clip_gap + clip_th*2;
74
75 module ClipElevationPositive(){
76   oval(lockshaft_or);
77   translate([-lockshaft_or[0], 0])
78     square([lockshaft_or[0]*2, cliprecess_ymax]);
79   translate([-clip_ogap/2, 0]) mirror([0,1]) square([clip_ogap, -clip_ymin]);
80 }
81
82 module ClipElevationNegative(){
83   hull(){
84     for (y=[0, cliprecess_ymax+1])
85       translate([0, y])
86         oval(lockshaft_r);
87   }
88   translate([-clip_gap/2, 1]) mirror([0,1]) square([clip_gap, 2-clip_ymin]);
89 }
90
91 module ClipElevation(){
92   difference(){
93     ClipElevationPositive(1);
94     ClipElevationNegative(0);
95   }
96 }
97
98 module ExtrudeClipElevation(extra=0){
99   translate([0,
100              lock_0y + lock_d/2 + clip_d + extra,
101              -clip_ymin])
102     rotate([90,0,0])
103     linear_extrude(height= clip_d + extra*2, convexity=100)
104     children(0);
105 }
106
107 module ThroughHole(r, y, z) {
108   translate([-50, y, z])
109     rotate([0, 90, 0])
110     cylinder(r=r, h=100, $fn=20);
111 }
112
113 module ThroughHoles(){
114   for (z=[ 1/4, 3/4 ]) {
115     ThroughHole( mountscrew_dia/2,
116                  -tube_or -0.5*backflange_d,
117                  total_h * z );
118   }
119
120   ThroughHole( clipbolt_dia/2,
121                lock_0y + lock_d/2 + clip_d/2,
122                total_h - cliprecess_h - clip_th - clip_d/2 );
123 }
124
125 module MainPositive(){
126   difference(){
127     union(){
128       linear_extrude(height=total_h, convexity=100) MainPlan();
129       ExtrudeClipElevation() ClipElevationPositive();
130     }
131     ExtrudeClipElevation(1) ClipElevationNegative();
132   }
133 }
134
135 //MainPlan();
136 //ClipElevation();
137 MainPositive();
138 %ThroughHoles();