9 pin_gap = 1.5; // around
25 bolt_gap = 1.0; // total, on both sides
27 // ---------- vhook ----------
31 // ---------- cleat ----------
36 cleat_horn_d_min = [10, 12];
37 cleat_horn_d_max = [12, 14];
41 cleat_overlap = (1-cos(60));
43 // ---------- hhook ----------
49 // ========== defaults ==========
53 pin_hole_dia = pin_dia/2;
54 pin_tail = pin_hole_dia + pin_head_th + hinge_z_gap*3;
58 // ========== calculated ==========
62 hole_dia = th + pin_gap;
64 bolt_hole_r = (bolt_dia + bolt_gap)/2;
66 main_r = tube_dia/2 + th;
70 hinge_o_r = 0.5 * hole_dia + th;
72 hinge_x = -0.5 * tube_dia - hinge_o_r;
73 bolt_x = 0.5 * tube_dia + th + bolt_flat * 0.5;
74 max_x = bolt_x + max(bolt_hole_r + th, 0.5 * bolt_flat/2);
76 flats_y = open_gap/2 + th;
78 stride_z = hinge_unit*2 + hinge_z_gap*2;
79 total_z = hinge_units * stride_z - hinge_z_gap;
84 pin_flatten = pin_dia/2 * (1 - cos(45));
86 bolt_stride = total_z / nbolts;
92 vhook_theta = atan2( smooth_r, main_r );
94 vhook_y0 = -max(main_r, (tube_dia/2 + vhook_th));
95 vhook_ctr = vhook_y0 - vhook_inside/2;
96 vhook_outer_dia = vhook_inside + vhook_th*2;
100 cleat_horn_tl = cleat_horn_l + cleat_stem_l/2;
103 $print_horiz ? 0 : max(0,
105 + cleat_horn_d_min[0]/2
106 - cleat_horn_d_min[0]/2 * cleat_overlap
110 // calculated - hhook
112 hhook_outer_dia = hhook_inside + hhook_th*2;
114 hhook_ctr = -max(main_r + hhook_inside/2,
115 tube_dia/2 + hhook_outer_dia/2);
121 offset(r=-smooth_r) offset(delta=smooth_r) children(0);
124 module TubePlan(){ circle(r = tube_dia/2); }
125 module MainCirclePlan(){ circle(r = main_r); }
127 module PlanWeldMainCircle(){
138 rotate(-135) square(100);
142 module MainPlan(flatten=false) {
146 translate([hinge_x, 0]) circle(r= hinge_o_r);
148 rectfromto([0, -flats_y],
152 rectfromto([0, -open_gap/2],
153 [max_x+1, +open_gap/2]);
154 translate([hinge_x, 0]) {
156 circle(r= hole_dia/2);
158 translate([ pin_flatten, 0 ])
159 square(center=true, [hole_dia, hole_dia + 1]);
165 module Portion(d=0) {
166 translate([hinge_x, 0]) circle(r= hinge_o_r + d);
167 rectfromto([hinge_x*2, 0],
168 [max_x+10, -(tube_dia/2+th+10)]);
171 module MainPlanA(flatten){
178 module MainPlanB(flatten){
185 module HalfClampX(flatten=false){
187 translate([0,0, min_z]) {
188 linextr(0, total_z) mirror([0,1]) MainPlanB();
189 for (i=[0 : hinge_units-1]) {
190 translate([0,0, stride_z*i])
191 linextr(0, hinge_unit) MainPlanA(flatten);
194 for (j=[0:nbolts-1]) {
195 translate([ bolt_x, 0, min_z + (j + 0.5) * bolt_stride ]) {
196 translate([0, -tube_dia/2, 0])
198 cylinder(r= bolt_hole_r, h= tube_dia);
199 translate([0, -flats_y, 0])
201 cylinder(r= bolt_flat/2, h= tube_dia/2);
207 // ---------- vhook ----------
209 module VHookProfile() {
210 translate([0, -vhook_inside/2 - vhook_th/2])
211 circle(r = vhook_th/2);
214 module VHookHookMain(outer=false){ ////toplevel
216 rotate_extrude(convexity=10)
221 translate([0,-vhook_outer_dia]) square(center=true, vhook_th);
226 module VHookA(){ ////toplevel
229 translate([0, vhook_ctr, 0]){
232 linextr(-0.1, vhook_outer_dia/2)
234 translate([0, -vhook_inside/2 -vhook_th/2, vhook_outer_dia/2])
235 sphere(r= vhook_th/2);
240 VHookHookMain(outer=true);
241 linextr_y_xz(0, vhook_outer_dia/2) hull(){
243 translate([0,-0.1]) square(center=true, [vhook_th, 0.2]);
249 translate([0,0, -vhook_outer_dia])
250 cube(center=true, vhook_outer_dia*2);
254 //translate([0, vhook_y0, 50]) rotate([0,0,-90]) color("black") cube(10);
255 // translate([0,0,-150]) rotate([0,0,180 + theta]) color("blue") cube(100);
258 module VHookPlanDemo(){
260 translate([0, vhook_ctr, 5])
263 color("blue") VHookProfile();
267 // ---------- cleat ----------
269 function cleat_frame_theta(s) = s * cleat_horn_tl / cleat_curve_r * 360/TAU;
270 function cleat_frame_z(s) = cleat_curve_r * (1 - cos(cleat_frame_theta(s)));
271 function cleat_frame_x(s) = cleat_curve_r * sin(cleat_frame_theta(s));
272 function cleat_frame_r(s) = ( cleat_horn_d_min * s +
273 cleat_horn_d_max * (1-s) ) * 0.5;
275 module CleatFrameSphere(r) {
276 scale([1, r[1]/r[0], 1])
280 module CleatFrame(s) {
281 r = cleat_frame_r(s);
282 translate([cleat_frame_x(s), 0, cleat_frame_z(s)])
289 for (si=[0 : cleat_frames-2]) {
290 s0 = si / (cleat_frames-1);
291 s1 = (si+1) / (cleat_frames-1);
300 frames = cleat_frames/2;
301 se = cleat_stem_l/2 / cleat_horn_tl;
302 r = cleat_frame_r(se);
305 for (s = [-se, se]) {
306 for (z= [-(cleat_height + tube_dia/2),
308 translate([cleat_frame_x(s), 0, z])
309 linear_extrude(height=0.1)
310 scale([1, r[1]/r[0]])
319 translate([0,0, vcleat_dz]){
321 translate([0, -(main_r + cleat_height), 0]) {
322 rotate([0, -90, 90]) {
331 linextr(-cleat_stem_l, +cleat_stem_l)
332 circle(r = tube_dia/2 + 0.1);
336 translate([0,0, total_z * 0.5])
338 (main_r + cleat_stem_l)*4 * [1,1,0] +
348 module VCleatAPrint(){ ////toplevel
349 rotate($print_horiz ? [90,0,0] : [0,0,0]) {
354 // ---------- hhook ----------
356 module HHookHookPlan(){
357 translate([0, hhook_ctr]){
359 circle(r = hhook_outer_dia/2);
360 circle(r = hhook_inside/2);
361 rectfromto([+hhook_outer_dia, -hhook_outer_dia],
362 [0, +hhook_outer_dia]);
364 translate([0, -(hhook_inside/2 + hhook_th/2)]){
366 for (x=[-0.1, hhook_l]) {
367 translate([x,0]) square(center=true, hhook_th);
374 module HHookA(){ ////toplevel
376 linextr(min_z, max_z) {
381 module HHookPlanDemo(){
386 // ---------- misc ----------
388 module PinSitu(){ ////toplevel
391 translate([0,0, -pin_head_th])
392 cylinder(r= pin_dia/2, h = total_z + pin_head_th + pin_tail);
394 cylinder(r= hinge_o_r - pin_gap, h = pin_head_th);
396 translate([0,0, total_z + pin_tail/2])
398 translate([0,0, -pin_dia])
399 cylinder(r= pin_hole_dia/2, h=pin_dia*2);
400 translate([pin_dia/2 * cos(45), -50, -pin_head_th*2])
401 cube([50,100, total_z*2]);
405 module Pin(){ ////toplevel
411 module GeneralB(){ ////toplevel
415 module DummyA(){ ////toplevel
419 module PlanDemo(){ ////toplevel
421 translate([0,0,-4]) color("red") Portion(1);
422 translate([0,0,-2]) color("grey") Portion(0);
424 translate([0, tube_dia*1.5]) {
429 translate([0, -tube_dia*1.5]) {
432 translate([tube_dia*4, 0]) {
435 // translate([max_x - hinge_x + 20, 0]) color("blue") MainPlanA();
438 module DemoA(){ DummyA(); }
440 module Demo(){ ////toplevel
441 color("red") rotate([180,0,0]) GeneralB();
442 color("blue") DemoA();
443 color("orange") translate([hinge_x, 0, min_z - hinge_z_gap])
444 rotate([0,0,180]) PinSitu();
447 module DemoPair(){ ////toplevel
448 color("red") rotate([180,0,0]) DemoA();
449 color("blue") DemoA();
450 color("orange") translate([hinge_x, 0, min_z - hinge_z_gap])
451 rotate([0,0,180]) PinSitu();