chiark / gitweb /
mic-table-clamp: Actually, StemBlankTest
[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 StemBlankPart(){
101   hull(){
102     cylinder(h = positive_l + 0.1 - blank_taper,
103              r = positive_blank_dia/2);
104     cylinder(h = positive_l + 0.1,
105              r = positive_blank_dia/2 - blank_taper);
106   }
107 }
108
109 module BlankStem(){ ////toplevel
110   StemWith()
111     StemBlankPart();
112 }
113
114 module Wingnut(){ ////toplevel
115   difference(){
116     union(){
117       cylinder(r= (thread_nom+wingnut_wall)/2,
118                h= wingnut_th);
119       minkowski(){
120         sphere(r= wingnut_cnr);
121         translate([0,0, wingnut_cnr*0.5])
122           linear_extrude(height= wingnut_wing_xh + wingnut_th
123                          - wingnut_cnr*1.5)
124           square([wingnut_wing_mindia + wingnut_wing_xrad*2 - wingnut_cnr*2,
125                   wingnut_wing_th - wingnut_cnr*2],
126                  center=true);
127       }
128     }
129     translate([0,0, wingnut_th])
130       linear_extrude(height= wingnut_wing_xh+1)
131       square(wingnut_wing_mindia, center=true);
132     translate([0,0, wingnut_th])
133       rotate([180,0,0])
134       OurThread(wingnut_th+3);
135     mirror([0,0,1])
136       linear_extrude(height=5)
137       square(center=true, wingnut_wing_mindia*2);
138   }
139 }
140
141 module ClampCollarPlan(){
142   circle(r= clamp_collar_r);
143 }
144 module ClampHolePlan(){
145   circle(r= clamp_hole_dia/2);
146 }
147 module ClampArmPlan(){
148   r = clamp_collar_r;
149   hull(){
150     rectfromto([r,       -clamp_w/2],
151                [clamp_l, +clamp_w/2]);
152     ClampCollarPlan();
153   }
154 }
155
156 module ClampTop(){ ////toplevel
157   linear_extrude(height = clamp_top_th, convexity=4) {
158     difference(){
159       union(){
160         ClampArmPlan();
161         ClampCollarPlan();
162       }
163       ClampHolePlan();
164     }
165   }
166   linear_extrude(height = clamp_reg_sz1, convexity=4) {
167     difference(){
168       for (m=[0,1]){
169         mirror([0,m,0])
170           translate([0, clamp_reg_sz2/2 + clamp_reg_clear_y, 0])
171           rectfromto([clamp_reg_bot_x_min - clamp_reg_extra_x, 0 ],
172                      [0,                           clamp_reg_sz1 ]);
173       }
174       ClampHolePlan();
175     }
176   }
177 }
178
179 module ClampBot(){ ////toplevel
180   linear_extrude(height = clamp_bot_th, convexity=4) {
181     difference(){
182       ClampArmPlan();
183       ClampHolePlan();
184     }
185   }
186   translate([clamp_l, 0, clamp_bot_th-0.1])
187     linear_extrude(height = clamp_bot_tooth_h +0.1)
188     rectfromto([ -clamp_bot_tooth_d, -clamp_w/2 ],
189                [  0,                 +clamp_w/2 ]);
190   translate([0,0, clamp_bot_th])
191     mirror([0,0,1])
192     linear_extrude(height = clamp_bot_collar)
193     difference(){
194     ClampCollarPlan();
195     ClampHolePlan();
196   }
197   translate([0, 0, clamp_bot_th]) {
198     linextr(-clamp_reg_sz2, clamp_max_table_th+clamp_reg_sz2) {
199       translate([clamp_reg_bot_x_min, 0]) {
200         rectfromto([ 0,             -clamp_reg_sz2/2 ],
201                    [ clamp_reg_sz2, +clamp_reg_sz2/2 ]);
202       }
203     }
204     linextr(-clamp_reg_sz2, 0) {
205       difference(){
206         rectfromto([ clamp_reg_bot_x_min, -clamp_reg_sz2/2 ],
207                    [  0,                  +clamp_reg_sz2/2 ]);
208         ClampHolePlan();
209       }
210     }
211   }
212 }
213
214 module StemBlankTest(){ ////toplevel
215   StemBlankPart();
216   linextr(-1.5,0) square(center=true, [10,35]);
217 }
218
219 module Demo(){ ////toplevel
220   color("blue") translate([0,0, clamp_top_th+0.5]) BlankStem();
221   color("red") ClampTop();
222   color("grey") translate([0,0, -(clamp_bot_th + 5)]) ClampBot();
223   translate([0,0, -(clamp_bot_collar +10)])
224     rotate([180,0,0]) Wingnut();
225 }
226
227 //Wingnut();
228 //Stem();