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