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 // ---------- linear bracket ----------
51 linear_bracket_h = 50;
52 linear_bracket_l = 100;
53 linear_bracket_t = 15;
54 linear_bracket_hole_offset = 20;
55 linear_bracket_hole_dia = 5 + 1.00;
57 // ========== defaults ==========
61 pin_hole_dia = pin_dia/2;
62 pin_tail = pin_hole_dia + pin_head_th + hinge_z_gap*3;
64 // ========== calculated ==========
68 hole_dia = th + pin_gap;
70 bolt_hole_r = (bolt_dia + bolt_gap)/2;
72 main_r = tube_dia/2 + th;
76 hinge_o_r = 0.5 * hole_dia + th;
78 hinge_x = -0.5 * tube_dia - hinge_o_r;
79 bolt_x = 0.5 * tube_dia + th + bolt_flat * 0.5;
80 max_x = bolt_x + max(bolt_hole_r + th, 0.5 * bolt_flat/2);
82 flats_y = open_gap/2 + th;
84 stride_z = hinge_unit*2 + hinge_z_gap*2;
85 total_z = hinge_units * stride_z - hinge_z_gap;
90 pin_flatten = pin_dia/2 * (1 - cos(45));
92 bolt_stride = total_z / nbolts;
98 vhook_theta = atan2( smooth_r, main_r );
100 vhook_y0 = -max(main_r, (tube_dia/2 + vhook_th));
101 vhook_ctr = vhook_y0 - vhook_inside/2;
102 vhook_outer_dia = vhook_inside + vhook_th*2;
104 // calculated - cleat
106 cleat_horn_tl = cleat_horn_l + cleat_stem_l/2;
110 + cleat_horn_d_min[0]/2
111 - cleat_horn_d_min[0]/2 * cleat_overlap
115 // calculated - hhook
117 hhook_outer_dia = hhook_inside + hhook_th*2;
119 hhook_ctr = -max(main_r + hhook_inside/2,
120 tube_dia/2 + hhook_outer_dia/2);
126 offset(r=-smooth_r) offset(delta=smooth_r) children(0);
129 module TubePlan(){ circle(r = tube_dia/2); }
130 module MainCirclePlan(){ circle(r = main_r); }
132 module PlanWeldMainCircle(){
143 rotate(-135) square(100);
147 module MainPlan(flatten=false) {
151 translate([hinge_x, 0]) circle(r= hinge_o_r);
153 rectfromto([0, -flats_y],
157 rectfromto([0, -open_gap/2],
158 [max_x+1, +open_gap/2]);
159 translate([hinge_x, 0]) {
161 circle(r= hole_dia/2);
163 translate([ pin_flatten, 0 ])
164 square(center=true, [hole_dia, hole_dia + 1]);
170 module Portion(d=0) {
171 translate([hinge_x, 0]) circle(r= hinge_o_r + d);
172 rectfromto([hinge_x*2, 0],
173 [max_x+10, -(tube_dia/2+th+10)]);
176 module MainPlanA(flatten){
183 module MainPlanB(flatten){
190 module HalfClampXPositive(flatten=false){
191 translate([0,0, min_z]) {
192 linextr(0, total_z) mirror([0,1]) MainPlanB();
193 for (i=[0 : hinge_units-1]) {
194 translate([0,0, stride_z*i])
195 linextr(0, hinge_unit) MainPlanA(flatten);
200 module HalfClampXNegative(){
201 for (j=[0:nbolts-1]) {
202 translate([ bolt_x, 0, min_z + (j + 0.5) * bolt_stride ]) {
203 translate([0, -tube_dia/2, 0])
205 cylinder(r= bolt_hole_r, h= tube_dia);
206 translate([0, -flats_y, 0])
208 cylinder(r= bolt_flat/2, h= tube_dia/2);
213 module HalfClampX(flatten=false){
215 HalfClampXPositive(flatten);
216 HalfClampXNegative();
220 // ---------- vhook ----------
222 module VHookProfile() {
223 translate([0, -vhook_inside/2 - vhook_th/2])
224 circle(r = vhook_th/2);
227 module VHookHookMain(outer=false){ ////toplevel
229 rotate_extrude(convexity=10)
234 translate([0,-vhook_outer_dia]) square(center=true, vhook_th);
239 module VHookA(){ ////toplevel
242 translate([0, vhook_ctr, 0]){
245 linextr(-0.1, vhook_outer_dia/2)
247 translate([0, -vhook_inside/2 -vhook_th/2, vhook_outer_dia/2])
248 sphere(r= vhook_th/2);
253 VHookHookMain(outer=true);
254 linextr_y_xz(0, vhook_outer_dia/2) hull(){
256 translate([0,-0.1]) square(center=true, [vhook_th, 0.2]);
262 translate([0,0, -vhook_outer_dia])
263 cube(center=true, vhook_outer_dia*2);
267 //translate([0, vhook_y0, 50]) rotate([0,0,-90]) color("black") cube(10);
268 // translate([0,0,-150]) rotate([0,0,180 + theta]) color("blue") cube(100);
271 module VHookPlanDemo(){
273 translate([0, vhook_ctr, 5])
276 color("blue") VHookProfile();
280 // ---------- cleat ----------
282 function cleat_frame_theta(s) = s * cleat_horn_tl / cleat_curve_r * 360/TAU;
283 function cleat_frame_z(s) = cleat_curve_r * (1 - cos(cleat_frame_theta(s)));
284 function cleat_frame_x(s) = cleat_curve_r * sin(cleat_frame_theta(s));
285 function cleat_frame_r(s) = ( cleat_horn_d_min * s +
286 cleat_horn_d_max * (1-s) ) * 0.5;
288 module CleatFrameSphere(r) {
289 scale([1, r[1]/r[0], 1])
293 module CleatFrame(s) {
294 r = cleat_frame_r(s);
295 translate([cleat_frame_x(s), 0, cleat_frame_z(s)])
302 for (si=[0 : cleat_frames-2]) {
303 s0 = si / (cleat_frames-1);
304 s1 = (si+1) / (cleat_frames-1);
313 frames = cleat_frames/2;
314 se = cleat_stem_l/2 / cleat_horn_tl;
315 r = cleat_frame_r(se);
318 for (s = [-se, se]) {
319 for (z= [-(cleat_height + tube_dia/2),
321 translate([cleat_frame_x(s), 0, z])
322 linear_extrude(height=0.1)
323 scale([1, r[1]/r[0]])
332 translate([0,0, vcleat_dz]){
334 translate([0, -(main_r + cleat_height), 0]) {
335 rotate([0, -90, 90]) {
344 linextr(-cleat_stem_l, +cleat_stem_l)
345 circle(r = tube_dia/2 + 0.1);
348 translate([0,0, total_z * 0.5])
350 (main_r + cleat_stem_l)*4 * [1,1,0] +
355 module VCleatA(){ ////toplevel
360 // ---------- hhook ----------
362 module HHookHookPlan(){
363 translate([0, hhook_ctr]){
365 circle(r = hhook_outer_dia/2);
366 circle(r = hhook_inside/2);
367 rectfromto([+hhook_outer_dia, -hhook_outer_dia],
368 [0, +hhook_outer_dia]);
370 translate([0, -(hhook_inside/2 + hhook_th/2)]){
372 for (x=[-0.1, hhook_l]) {
373 translate([x,0]) square(center=true, hhook_th);
380 module HHookA(){ ////toplevel
382 linextr(min_z, max_z) {
387 module HHookPlanDemo(){
392 // ---------- linear bracket ----------
394 module LinearBracketA(){ ////toplevel
397 HalfClampXPositive();
399 linextr_y_xz(-open_gap/2 - linear_bracket_t, -open_gap/2)
400 rectfromto([0, min_z],
401 [max_x + linear_bracket_l, min_z + linear_bracket_h]);
403 HalfClampXNegative();
407 linextr_y_xz(-100,100) {
409 [1,1] * linear_bracket_hole_offset,
410 -[1,1] * linear_bracket_hole_offset +
411 [linear_bracket_l, linear_bracket_h]
413 translate([ max_x, min_z ] + t)
414 circle(r= linear_bracket_hole_dia/2);
420 // ---------- misc ----------
422 module PinSitu(){ ////toplevel
425 translate([0,0, -pin_head_th])
426 cylinder(r= pin_dia/2, h = total_z + pin_head_th + pin_tail);
428 cylinder(r= hinge_o_r - pin_gap, h = pin_head_th);
430 translate([0,0, total_z + pin_tail/2])
432 translate([0,0, -pin_dia])
433 cylinder(r= pin_hole_dia/2, h=pin_dia*2);
434 translate([pin_dia/2 * cos(45), -50, -pin_head_th*2])
435 cube([50,100, total_z*2]);
439 module Pin(){ ////toplevel
445 module GeneralB(){ ////toplevel
449 module DummyA(){ ////toplevel
453 module PlanDemo(){ ////toplevel
455 translate([0,0,-4]) color("red") Portion(1);
456 translate([0,0,-2]) color("grey") Portion(0);
458 translate([0, tube_dia*1.5]) {
463 translate([0, -tube_dia*1.5]) {
466 translate([tube_dia*4, 0]) {
469 // translate([max_x - hinge_x + 20, 0]) color("blue") MainPlanA();
472 module DemoA(){ DummyA(); }
474 module Demo(){ ////toplevel
475 color("red") rotate([180,0,0]) GeneralB();
476 color("blue") DemoA();
477 color("orange") translate([hinge_x, 0, min_z - hinge_z_gap])
478 rotate([0,0,180]) PinSitu();
481 module DemoPair(){ ////toplevel
482 color("red") rotate([180,0,0]) DemoA();
483 color("blue") DemoA();
484 color("orange") translate([hinge_x, 0, min_z - hinge_z_gap])
485 rotate([0,0,180]) PinSitu();