chiark / gitweb /
scaffold-clamp: wip straphook
[reprap-play.git] / scaffold-clamp-common.scad
1 // -*- C -*-
2
3 include <utils.scad>
4
5 tube_dia = 48.3;
6
7 th = 7;
8
9 pin_gap = 1.5; // around
10
11 smooth_r = 15;
12
13 bolt_dia = 5 + 0.75;
14 bolt_flat = 10 + 1;
15
16 open_gap = 10;
17
18 hinge_unit = 10;
19 hinge_z_gap = 1;
20
21 hinge_units = 4;
22
23 // ---------- vhook ----------
24
25 vhook_th = 14;
26
27 // ---------- hhook ----------
28
29 hhook_inner = 40;
30 hhook_th = 4;
31
32 // ========== calculated ==========
33
34 pin_dia = th;
35 hole_dia = th + pin_gap;
36
37 main_r = tube_dia/2 + th;
38
39 hinge_gap = pin_gap;
40
41 hinge_o_r = 0.5 * hole_dia + th;
42
43 hinge_x = -0.5 * tube_dia - hinge_o_r;
44 bolt_x = 0.5 * tube_dia + th + bolt_flat * 0.5;
45 max_x = bolt_x + max(0.5 + bolt_dia + th, 0.5 * bolt_flat/2);
46
47 flats_y = open_gap/2 + th;
48
49 stride_z = hinge_unit*2 + hinge_z_gap*2;
50 total_z = hinge_units * stride_z - hinge_z_gap;
51
52 min_z = -total_z/2;
53 max_z = +total_z/2;
54
55 pin_flatten = pin_dia/2 * (1 - cos(45));
56
57 // calculated - vhook
58
59 vhook_inside = 15;
60
61 vhook_theta = atan2( smooth_r, main_r );
62
63 vhook_y0 = -max(main_r, (tube_dia/2 + vhook_th));
64 vhook_ctr = vhook_y0 - vhook_inside/2;
65 vhook_outer_dia = vhook_inside + vhook_th*2;
66
67
68 $fa = 3;
69 $fs = 0.1;
70
71 module SmoothPlan(){
72   offset(r=-smooth_r) offset(delta=smooth_r) children(0);
73 }
74
75 module TubePlan(){ circle(r = tube_dia/2); }
76 module MainCirclePlan(){ circle(r = main_r); }
77
78 module PlanWeldMainCircle(){
79   intersection(){
80     difference(){
81       SmoothPlan(){
82         union(){
83           MainCirclePlan();
84           children(0);
85         }
86       }
87       TubePlan();
88     }
89     rotate(-135) square(100);
90   }
91 }
92
93 module MainPlan(flatten=false) {
94   difference(){
95     SmoothPlan()
96       union(){
97       translate([hinge_x, 0]) circle(r= hinge_o_r);
98       MainCirclePlan();
99       rectfromto([0,           -flats_y],
100                  [max_x,       +flats_y]);
101     }
102     TubePlan();
103     rectfromto([0,       -open_gap/2],
104                [max_x+1, +open_gap/2]);
105     translate([hinge_x, 0]) {
106       intersection(){
107         circle(r= hole_dia/2);
108         if (flatten)
109           translate([ pin_flatten, 0 ])
110           square(center=true, [hole_dia, hole_dia + 1]);
111       }
112     }
113   }
114 }
115
116 module Portion(d=0) {
117   translate([hinge_x, 0]) circle(r= hinge_o_r + d);
118   rectfromto([hinge_x*2, 0],
119              [max_x+10, -(tube_dia/2+th+10)]);
120 }
121
122 module MainPlanA(flatten){
123   intersection(){
124     MainPlan(flatten);
125     Portion(0);
126   }
127 }
128
129 module MainPlanB(flatten){
130   difference(){
131     MainPlan(flatten);
132     Portion(hinge_gap);
133   }
134 }
135
136 module HalfClampX(flatten=false){
137   difference(){
138     translate([0,0, min_z]) {
139       linextr(0, total_z) mirror([0,1]) MainPlanB();
140       for (i=[0 : hinge_units-1]) {
141         translate([0,0, stride_z*i])
142           linextr(0, hinge_unit) MainPlanA(flatten);
143       }
144     }
145     for (dz=[-1,+1]) {
146       translate([ bolt_x, 0, dz * total_z/4 ]) {
147         translate([0, -tube_dia/2, 0])
148           rotate([-90,0,0])
149           cylinder(r= bolt_dia/2, h= tube_dia);
150         translate([0, -flats_y, 0])
151           rotate([90,0,0])
152           cylinder(r= bolt_flat/2, h= tube_dia/2);
153       }
154     }
155   }
156 }
157
158 // ---------- vhook ----------
159
160 module VHookProfile() {
161   translate([0, -vhook_inside/2 - vhook_th/2])
162     circle(r = vhook_th/2);
163 }
164
165 module VHookHookMain(outer=false){ ////toplevel
166   rotate([0,90,0])
167     rotate_extrude(convexity=10)
168     rotate([0,0,90])
169     hull(){
170       VHookProfile();
171       if (outer) {
172         translate([0,-vhook_outer_dia]) square(center=true, vhook_th);
173       }
174     }
175 }
176
177 module VHookPartA(){ ////toplevel
178   DummyA();
179
180   translate([0, vhook_ctr, 0]){
181     for (m=[0,1]) {
182       mirror([0, m, 0]) {
183         linextr(-0.1, vhook_outer_dia/2)
184           VHookProfile();
185         translate([0, -vhook_inside/2 -vhook_th/2, vhook_outer_dia/2])
186           sphere(r= vhook_th/2);
187       }
188     }
189
190     intersection(){
191       VHookHookMain(outer=true);
192       linextr_y_xz(0, vhook_outer_dia/2) hull(){
193         VHookProfile();
194         translate([0,-0.1]) square(center=true, [vhook_th, 0.2]);
195       }
196     }
197
198     intersection(){
199       VHookHookMain();
200       translate([0,0, -vhook_outer_dia])
201         cube(center=true, vhook_outer_dia*2);
202     }
203   }
204
205   //translate([0, vhook_y0, 50]) rotate([0,0,-90]) color("black") cube(10);
206   // translate([0,0,-150]) rotate([0,0,180 + theta]) color("blue") cube(100);
207 }
208
209 module VHookPlanDemo(){
210   MainPlanA();
211   translate([0, vhook_ctr, 5])
212     for (m=[0,1]) {
213       mirror([0,m])
214         color("blue") VHookProfile();
215     }
216 }
217
218 // ---------- hhook ----------
219
220 module HHookPlanDemo(){
221   MainPlanA();
222 }
223
224 // ---------- misc ----------
225
226 module GeneralB(){ ////toplevel
227   HalfClampX(true);
228 }
229
230 module DummyA(){ ////toplevel
231   HalfClampX();
232 }
233
234 module PlanDemo(){ ////toplevel
235   MainPlan();
236   translate([0,0,-4]) color("red") Portion(1);
237   translate([0,0,-2]) color("grey") Portion(0);
238
239   translate([0, tube_dia*1.5]) {
240     MainPlanB();
241     MainPlanA();
242   }
243
244   translate([0, -tube_dia*1.5]) {
245     VHookPlanDemo();
246   }
247   translate([tube_dia*4, 0]) {
248     HHookPlanDemo();
249   }
250 //  translate([max_x - hinge_x + 20, 0]) color("blue") MainPlanA();
251 }
252
253 module Demo(){ ////toplevel
254   color("red") rotate([180,0,0]) GeneralB();
255   color("blue") DummyA();
256 }
257
258 //PlanDemo();
259 //HalfClamp();