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