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