9 pin_gap = 1.5; // around
25 bolt_gap = 1.0; // total, on both sides
27 // ---------- vhook ----------
31 // ---------- hhook ----------
37 // ========== defaults ==========
41 pin_hole_dia = pin_dia/2;
42 pin_tail = pin_hole_dia + pin_head_th + hinge_z_gap*3;
44 // ========== calculated ==========
46 hole_dia = th + pin_gap;
48 bolt_hole_r = (bolt_dia + bolt_gap)/2;
50 main_r = tube_dia/2 + th;
54 hinge_o_r = 0.5 * hole_dia + th;
56 hinge_x = -0.5 * tube_dia - hinge_o_r;
57 bolt_x = 0.5 * tube_dia + th + bolt_flat * 0.5;
58 max_x = bolt_x + max(bolt_hole_r + th, 0.5 * bolt_flat/2);
60 flats_y = open_gap/2 + th;
62 stride_z = hinge_unit*2 + hinge_z_gap*2;
63 total_z = hinge_units * stride_z - hinge_z_gap;
68 pin_flatten = pin_dia/2 * (1 - cos(45));
70 bolt_stride = total_z / nbolts;
76 vhook_theta = atan2( smooth_r, main_r );
78 vhook_y0 = -max(main_r, (tube_dia/2 + vhook_th));
79 vhook_ctr = vhook_y0 - vhook_inside/2;
80 vhook_outer_dia = vhook_inside + vhook_th*2;
84 hhook_outer_dia = hhook_inside + hhook_th*2;
86 hhook_ctr = -max(main_r + hhook_inside/2,
87 tube_dia/2 + hhook_outer_dia/2);
93 offset(r=-smooth_r) offset(delta=smooth_r) children(0);
96 module TubePlan(){ circle(r = tube_dia/2); }
97 module MainCirclePlan(){ circle(r = main_r); }
99 module PlanWeldMainCircle(){
110 rotate(-135) square(100);
114 module MainPlan(flatten=false) {
118 translate([hinge_x, 0]) circle(r= hinge_o_r);
120 rectfromto([0, -flats_y],
124 rectfromto([0, -open_gap/2],
125 [max_x+1, +open_gap/2]);
126 translate([hinge_x, 0]) {
128 circle(r= hole_dia/2);
130 translate([ pin_flatten, 0 ])
131 square(center=true, [hole_dia, hole_dia + 1]);
137 module Portion(d=0) {
138 translate([hinge_x, 0]) circle(r= hinge_o_r + d);
139 rectfromto([hinge_x*2, 0],
140 [max_x+10, -(tube_dia/2+th+10)]);
143 module MainPlanA(flatten){
150 module MainPlanB(flatten){
157 module HalfClampX(flatten=false){
159 translate([0,0, min_z]) {
160 linextr(0, total_z) mirror([0,1]) MainPlanB();
161 for (i=[0 : hinge_units-1]) {
162 translate([0,0, stride_z*i])
163 linextr(0, hinge_unit) MainPlanA(flatten);
166 for (j=[0:nbolts-1]) {
167 translate([ bolt_x, 0, min_z + (j + 0.5) * bolt_stride ]) {
168 translate([0, -tube_dia/2, 0])
170 cylinder(r= bolt_hole_r, h= tube_dia);
171 translate([0, -flats_y, 0])
173 cylinder(r= bolt_flat/2, h= tube_dia/2);
179 // ---------- vhook ----------
181 module VHookProfile() {
182 translate([0, -vhook_inside/2 - vhook_th/2])
183 circle(r = vhook_th/2);
186 module VHookHookMain(outer=false){ ////toplevel
188 rotate_extrude(convexity=10)
193 translate([0,-vhook_outer_dia]) square(center=true, vhook_th);
198 module VHookA(){ ////toplevel
201 translate([0, vhook_ctr, 0]){
204 linextr(-0.1, vhook_outer_dia/2)
206 translate([0, -vhook_inside/2 -vhook_th/2, vhook_outer_dia/2])
207 sphere(r= vhook_th/2);
212 VHookHookMain(outer=true);
213 linextr_y_xz(0, vhook_outer_dia/2) hull(){
215 translate([0,-0.1]) square(center=true, [vhook_th, 0.2]);
221 translate([0,0, -vhook_outer_dia])
222 cube(center=true, vhook_outer_dia*2);
226 //translate([0, vhook_y0, 50]) rotate([0,0,-90]) color("black") cube(10);
227 // translate([0,0,-150]) rotate([0,0,180 + theta]) color("blue") cube(100);
230 module VHookPlanDemo(){
232 translate([0, vhook_ctr, 5])
235 color("blue") VHookProfile();
239 // ---------- hhook ----------
241 module HHookHookPlan(){
242 translate([0, hhook_ctr]){
244 circle(r = hhook_outer_dia/2);
245 circle(r = hhook_inside/2);
246 rectfromto([+hhook_outer_dia, -hhook_outer_dia],
247 [0, +hhook_outer_dia]);
249 translate([0, -(hhook_inside/2 + hhook_th/2)]){
251 for (x=[-0.1, hhook_l]) {
252 translate([x,0]) square(center=true, hhook_th);
259 module HHookA(){ ////toplevel
261 linextr(min_z, max_z) {
266 module HHookPlanDemo(){
271 // ---------- misc ----------
273 module PinSitu(){ ////toplevel
276 translate([0,0, -pin_head_th])
277 cylinder(r= pin_dia/2, h = total_z + pin_head_th + pin_tail);
279 cylinder(r= hinge_o_r - pin_gap, h = pin_head_th);
281 translate([0,0, total_z + pin_tail/2])
283 translate([0,0, -pin_dia])
284 cylinder(r= pin_hole_dia/2, h=pin_dia*2);
285 translate([pin_dia/2 * cos(45), -50, -pin_head_th*2])
286 cube([50,100, total_z*2]);
290 module Pin(){ ////toplevel
296 module GeneralB(){ ////toplevel
300 module DummyA(){ ////toplevel
304 module PlanDemo(){ ////toplevel
306 translate([0,0,-4]) color("red") Portion(1);
307 translate([0,0,-2]) color("grey") Portion(0);
309 translate([0, tube_dia*1.5]) {
314 translate([0, -tube_dia*1.5]) {
317 translate([tube_dia*4, 0]) {
320 // translate([max_x - hinge_x + 20, 0]) color("blue") MainPlanA();
323 module DemoA(){ DummyA(); }
325 module Demo(){ ////toplevel
326 color("red") rotate([180,0,0]) GeneralB();
327 color("blue") DemoA();
328 color("orange") translate([hinge_x, 0, min_z - hinge_z_gap])
329 rotate([0,0,180]) PinSitu();