9 pin_gap = 1.5; // around
25 bolt_gap = 1.0; // total, on both sides
27 // ---------- vhook ----------
31 // ---------- cleat ----------
36 cleat_horn_d_min = [8, 10];
37 cleat_horn_d_max = [10, 12];
41 // ---------- hhook ----------
47 // ========== defaults ==========
51 pin_hole_dia = pin_dia/2;
52 pin_tail = pin_hole_dia + pin_head_th + hinge_z_gap*3;
54 // ========== calculated ==========
58 hole_dia = th + pin_gap;
60 bolt_hole_r = (bolt_dia + bolt_gap)/2;
62 main_r = tube_dia/2 + th;
66 hinge_o_r = 0.5 * hole_dia + th;
68 hinge_x = -0.5 * tube_dia - hinge_o_r;
69 bolt_x = 0.5 * tube_dia + th + bolt_flat * 0.5;
70 max_x = bolt_x + max(bolt_hole_r + th, 0.5 * bolt_flat/2);
72 flats_y = open_gap/2 + th;
74 stride_z = hinge_unit*2 + hinge_z_gap*2;
75 total_z = hinge_units * stride_z - hinge_z_gap;
80 pin_flatten = pin_dia/2 * (1 - cos(45));
82 bolt_stride = total_z / nbolts;
88 vhook_theta = atan2( smooth_r, main_r );
90 vhook_y0 = -max(main_r, (tube_dia/2 + vhook_th));
91 vhook_ctr = vhook_y0 - vhook_inside/2;
92 vhook_outer_dia = vhook_inside + vhook_th*2;
96 hhook_outer_dia = hhook_inside + hhook_th*2;
98 hhook_ctr = -max(main_r + hhook_inside/2,
99 tube_dia/2 + hhook_outer_dia/2);
105 offset(r=-smooth_r) offset(delta=smooth_r) children(0);
108 module TubePlan(){ circle(r = tube_dia/2); }
109 module MainCirclePlan(){ circle(r = main_r); }
111 module PlanWeldMainCircle(){
122 rotate(-135) square(100);
126 module MainPlan(flatten=false) {
130 translate([hinge_x, 0]) circle(r= hinge_o_r);
132 rectfromto([0, -flats_y],
136 rectfromto([0, -open_gap/2],
137 [max_x+1, +open_gap/2]);
138 translate([hinge_x, 0]) {
140 circle(r= hole_dia/2);
142 translate([ pin_flatten, 0 ])
143 square(center=true, [hole_dia, hole_dia + 1]);
149 module Portion(d=0) {
150 translate([hinge_x, 0]) circle(r= hinge_o_r + d);
151 rectfromto([hinge_x*2, 0],
152 [max_x+10, -(tube_dia/2+th+10)]);
155 module MainPlanA(flatten){
162 module MainPlanB(flatten){
169 module HalfClampX(flatten=false){
171 translate([0,0, min_z]) {
172 linextr(0, total_z) mirror([0,1]) MainPlanB();
173 for (i=[0 : hinge_units-1]) {
174 translate([0,0, stride_z*i])
175 linextr(0, hinge_unit) MainPlanA(flatten);
178 for (j=[0:nbolts-1]) {
179 translate([ bolt_x, 0, min_z + (j + 0.5) * bolt_stride ]) {
180 translate([0, -tube_dia/2, 0])
182 cylinder(r= bolt_hole_r, h= tube_dia);
183 translate([0, -flats_y, 0])
185 cylinder(r= bolt_flat/2, h= tube_dia/2);
191 // ---------- vhook ----------
193 module VHookProfile() {
194 translate([0, -vhook_inside/2 - vhook_th/2])
195 circle(r = vhook_th/2);
198 module VHookHookMain(outer=false){ ////toplevel
200 rotate_extrude(convexity=10)
205 translate([0,-vhook_outer_dia]) square(center=true, vhook_th);
210 module VHookA(){ ////toplevel
213 translate([0, vhook_ctr, 0]){
216 linextr(-0.1, vhook_outer_dia/2)
218 translate([0, -vhook_inside/2 -vhook_th/2, vhook_outer_dia/2])
219 sphere(r= vhook_th/2);
224 VHookHookMain(outer=true);
225 linextr_y_xz(0, vhook_outer_dia/2) hull(){
227 translate([0,-0.1]) square(center=true, [vhook_th, 0.2]);
233 translate([0,0, -vhook_outer_dia])
234 cube(center=true, vhook_outer_dia*2);
238 //translate([0, vhook_y0, 50]) rotate([0,0,-90]) color("black") cube(10);
239 // translate([0,0,-150]) rotate([0,0,180 + theta]) color("blue") cube(100);
242 module VHookPlanDemo(){
244 translate([0, vhook_ctr, 5])
247 color("blue") VHookProfile();
251 // ---------- cleat ----------
253 function cleat_frame_theta(s) = s * cleat_horn_l / cleat_curve_r * 360/TAU;
254 function cleat_frame_z(s) = cleat_curve_r * (1 - cos(cleat_frame_theta(s)));
255 function cleat_frame_x(s) = cleat_curve_r * sin(cleat_frame_theta(s));
256 function cleat_frame_r(s) = ( cleat_horn_d_min * s +
257 cleat_horn_d_max * (1-s) ) * 0.5;
259 module CleatFrameSphere(r) {
260 scale([1, r[1]/r[0], 1])
264 module CleatFrame(s) {
265 r = cleat_frame_r(s);
266 translate([cleat_frame_x(s), 0, cleat_frame_z(s)])
273 for (si=[0 : cleat_frames-2]) {
274 s0 = si / (cleat_frames-1);
275 s1 = (si+1) / (cleat_frames-1);
284 frames = cleat_frames/2;
285 se = cleat_stem_l/2 / cleat_horn_l;
286 r = cleat_frame_r(se);
288 for (si=[0: frames-2]) {
289 s0 = se * si / (frames-1);
290 s1 = se * (si+1) / (frames-1);
292 for (z= [-(cleat_height + tube_dia/2),
293 cleat_frame_z(se)]) {
294 translate([cleat_frame_x(se), 0, z])
300 for (si=[0 : cleat_frames-2]) {
301 s0 = si / (cleat_frames-1);
302 s1 = (si+1) / (cleat_frames-1);
310 module VCleatA(){ ////toplevel
313 translate([0, -(main_r + cleat_height), 0]) {
314 rotate([0, -90, 90]) {
327 // ---------- hhook ----------
329 module HHookHookPlan(){
330 translate([0, hhook_ctr]){
332 circle(r = hhook_outer_dia/2);
333 circle(r = hhook_inside/2);
334 rectfromto([+hhook_outer_dia, -hhook_outer_dia],
335 [0, +hhook_outer_dia]);
337 translate([0, -(hhook_inside/2 + hhook_th/2)]){
339 for (x=[-0.1, hhook_l]) {
340 translate([x,0]) square(center=true, hhook_th);
347 module HHookA(){ ////toplevel
349 linextr(min_z, max_z) {
354 module HHookPlanDemo(){
359 // ---------- misc ----------
361 module PinSitu(){ ////toplevel
364 translate([0,0, -pin_head_th])
365 cylinder(r= pin_dia/2, h = total_z + pin_head_th + pin_tail);
367 cylinder(r= hinge_o_r - pin_gap, h = pin_head_th);
369 translate([0,0, total_z + pin_tail/2])
371 translate([0,0, -pin_dia])
372 cylinder(r= pin_hole_dia/2, h=pin_dia*2);
373 translate([pin_dia/2 * cos(45), -50, -pin_head_th*2])
374 cube([50,100, total_z*2]);
378 module Pin(){ ////toplevel
384 module GeneralB(){ ////toplevel
388 module DummyA(){ ////toplevel
392 module PlanDemo(){ ////toplevel
394 translate([0,0,-4]) color("red") Portion(1);
395 translate([0,0,-2]) color("grey") Portion(0);
397 translate([0, tube_dia*1.5]) {
402 translate([0, -tube_dia*1.5]) {
405 translate([tube_dia*4, 0]) {
408 // translate([max_x - hinge_x + 20, 0]) color("blue") MainPlanA();
411 module DemoA(){ DummyA(); }
413 module Demo(){ ////toplevel
414 color("red") rotate([180,0,0]) GeneralB();
415 color("blue") DemoA();
416 color("orange") translate([hinge_x, 0, min_z - hinge_z_gap])
417 rotate([0,0,180]) PinSitu();