chiark / gitweb /
26de11850f14dafb089d463b7075b325a696a7f0
[reprap-play.git] / mic-table-clamp.scad
1 // -*- C -*-
2
3 // print Stem and Wingnut on High Detail
4 // but adjust shell thickness to 2mm
5
6 // others on Standard
7
8 include <utils.scad>
9 include <threads.scad>
10 include <camera-mount.scad>
11
12 positive_dia = inch * 3/8. - 0.375;
13 positive_l = inch * 1/2.;
14
15 positive_blank_dia = 8.25;
16 blank_l = 17;
17 blank_taper = 1.0;
18
19 stem_l = 40;
20 stem_dia = 12;
21 stem_th = 3;
22 stem_ceil = 2;
23 stem_base_th  = 4;
24 stem_base_dia = 25;
25 stem_inner_l = 15;
26
27 thread_nom = 8;
28 thread_pitch = 1.25;
29 thread_act = thread_nom + 0.600;
30
31 clamp_l = 40;
32 clamp_top_th = 7;
33 clamp_bot_th = 10;
34 clamp_bot_tooth_h = 2.5;
35 clamp_bot_tooth_d  = 10;
36 clamp_bot_collar = 20;
37 clamp_bot_collar_th = 3.0;
38 clamp_reg_sz1 = 3;
39 clamp_reg_sz2 = 5;
40 clamp_w = 15;
41 clamp_max_table_th = 35;
42
43 clamp_hole_dia = thread_nom + 0.30;
44
45 clamp_reg_clear_x = 2.5;
46 clamp_reg_clear_y = 0.75; // each side
47 clamp_reg_extra_x = 4;
48
49 //ct_h = 7;
50
51 wingnut_th = 5;
52 wingnut_wall = 4;
53 wingnut_wing_mindia = 17.0;
54 wingnut_wing_xrad = 8;
55 wingnut_wing_xh = 5;
56 wingnut_wing_th = 3;
57
58 $test= true;
59 ///$test= false;
60
61 //$fa= 3;
62 //$fs= 0.2;
63
64 // calculated
65
66 wingnut_cnr = wingnut_wing_th/2 -0.1;
67
68 clamp_reg_bot_x_min = -stem_base_dia/2 -clamp_reg_clear_x -clamp_reg_sz2;
69 clamp_collar_r = thread_nom/2 + clamp_bot_collar_th;
70
71 module OurThread(l){
72   translate([0,0,-0.01])
73     metric_thread(diameter=thread_act, pitch=thread_pitch,
74                   leadin=3, internal=true,
75                   test=$test, length=l);
76 }
77
78 module StemWith(){
79   translate([0,0, stem_l -0.1])
80     children();
81
82   difference(){
83     union(){
84       cylinder(r= stem_dia/2 * 1/(0.5 * sqrt(3)),
85                h = stem_l,
86                $fn=6);
87       cylinder(r= stem_base_dia/2,
88                h = stem_base_th);
89     }
90     OurThread(stem_inner_l);
91   }
92 }  
93
94 module Stem(){ ////toplevel
95   StemWith()
96     english_thread(diameter=positive_dia/inch, threads_per_inch=16,
97                    leadin=1, test=$test,
98                    length= (positive_l + 0.1) / inch);
99 }
100
101 module StemBlankPart(){
102   hull(){
103     cylinder(h = blank_l + 0.1 - blank_taper,
104              r = positive_blank_dia/2);
105     cylinder(h = blank_l + 0.1,
106              r = positive_blank_dia/2 - blank_taper);
107   }
108 }
109
110 module BlankStem(){ ////toplevel
111   StemWith()
112     StemBlankPart();
113 }
114
115 module Wingnut(){ ////toplevel
116   difference(){
117     union(){
118       cylinder(r= (thread_nom+wingnut_wall)/2,
119                h= wingnut_th);
120       minkowski(){
121         sphere(r= wingnut_cnr);
122         translate([0,0, wingnut_cnr*0.5])
123           linear_extrude(height= wingnut_wing_xh + wingnut_th
124                          - wingnut_cnr*1.5)
125           square([wingnut_wing_mindia + wingnut_wing_xrad*2 - wingnut_cnr*2,
126                   wingnut_wing_th - wingnut_cnr*2],
127                  center=true);
128       }
129     }
130     translate([0,0, wingnut_th])
131       linear_extrude(height= wingnut_wing_xh+1)
132       square(wingnut_wing_mindia, center=true);
133     translate([0,0, wingnut_th])
134       rotate([180,0,0])
135       OurThread(wingnut_th+3);
136     mirror([0,0,1])
137       linear_extrude(height=5)
138       square(center=true, wingnut_wing_mindia*2);
139   }
140 }
141
142 module ClampCollarPlan(){
143   circle(r= clamp_collar_r);
144 }
145 module ClampHolePlan(){
146   circle(r= clamp_hole_dia/2);
147 }
148 module ClampArmPlan(){
149   r = clamp_collar_r;
150   hull(){
151     rectfromto([r,       -clamp_w/2],
152                [clamp_l, +clamp_w/2]);
153     ClampCollarPlan();
154   }
155 }
156
157 module ClampTop(){ ////toplevel
158   linear_extrude(height = clamp_top_th, convexity=4) {
159     difference(){
160       union(){
161         ClampArmPlan();
162         ClampCollarPlan();
163       }
164       ClampHolePlan();
165     }
166   }
167   linear_extrude(height = clamp_reg_sz1, convexity=4) {
168     difference(){
169       for (m=[0,1]){
170         mirror([0,m,0])
171           translate([0, clamp_reg_sz2/2 + clamp_reg_clear_y, 0])
172           rectfromto([clamp_reg_bot_x_min - clamp_reg_extra_x, 0 ],
173                      [0,                           clamp_reg_sz1 ]);
174       }
175       ClampHolePlan();
176     }
177   }
178 }
179
180 module ClampBot(){ ////toplevel
181   linear_extrude(height = clamp_bot_th, convexity=4) {
182     difference(){
183       ClampArmPlan();
184       ClampHolePlan();
185     }
186   }
187   translate([clamp_l, 0, clamp_bot_th-0.1])
188     linear_extrude(height = clamp_bot_tooth_h +0.1)
189     rectfromto([ -clamp_bot_tooth_d, -clamp_w/2 ],
190                [  0,                 +clamp_w/2 ]);
191   translate([0,0, clamp_bot_th])
192     mirror([0,0,1])
193     linear_extrude(height = clamp_bot_collar)
194     difference(){
195     ClampCollarPlan();
196     ClampHolePlan();
197   }
198   translate([0, 0, clamp_bot_th]) {
199     linextr(-clamp_reg_sz2, clamp_max_table_th+clamp_reg_sz2) {
200       translate([clamp_reg_bot_x_min, 0]) {
201         rectfromto([ 0,             -clamp_reg_sz2/2 ],
202                    [ clamp_reg_sz2, +clamp_reg_sz2/2 ]);
203       }
204     }
205     linextr(-clamp_reg_sz2, 0) {
206       difference(){
207         rectfromto([ clamp_reg_bot_x_min, -clamp_reg_sz2/2 ],
208                    [  0,                  +clamp_reg_sz2/2 ]);
209         ClampHolePlan();
210       }
211     }
212   }
213 }
214
215 module StemBlankTest(){ ////toplevel
216   StemBlankPart();
217   linextr(-1.5,0) square(center=true, [10,35]);
218 }
219
220 module Demo(){ ////toplevel
221   color("blue") translate([0,0, clamp_top_th+0.5]) BlankStem();
222   color("red") ClampTop();
223   color("grey") translate([0,0, -(clamp_bot_th + 5)]) ClampBot();
224   translate([0,0, -(clamp_bot_collar +10)])
225     rotate([180,0,0]) Wingnut();
226 }
227
228 //Wingnut();
229 //Stem();