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 // ---------- 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 cleat_horn_tl = cleat_horn_l + cleat_stem_l/2;
100 hhook_outer_dia = hhook_inside + hhook_th*2;
102 hhook_ctr = -max(main_r + hhook_inside/2,
103 tube_dia/2 + hhook_outer_dia/2);
109 offset(r=-smooth_r) offset(delta=smooth_r) children(0);
112 module TubePlan(){ circle(r = tube_dia/2); }
113 module MainCirclePlan(){ circle(r = main_r); }
115 module PlanWeldMainCircle(){
126 rotate(-135) square(100);
130 module MainPlan(flatten=false) {
134 translate([hinge_x, 0]) circle(r= hinge_o_r);
136 rectfromto([0, -flats_y],
140 rectfromto([0, -open_gap/2],
141 [max_x+1, +open_gap/2]);
142 translate([hinge_x, 0]) {
144 circle(r= hole_dia/2);
146 translate([ pin_flatten, 0 ])
147 square(center=true, [hole_dia, hole_dia + 1]);
153 module Portion(d=0) {
154 translate([hinge_x, 0]) circle(r= hinge_o_r + d);
155 rectfromto([hinge_x*2, 0],
156 [max_x+10, -(tube_dia/2+th+10)]);
159 module MainPlanA(flatten){
166 module MainPlanB(flatten){
173 module HalfClampX(flatten=false){
175 translate([0,0, min_z]) {
176 linextr(0, total_z) mirror([0,1]) MainPlanB();
177 for (i=[0 : hinge_units-1]) {
178 translate([0,0, stride_z*i])
179 linextr(0, hinge_unit) MainPlanA(flatten);
182 for (j=[0:nbolts-1]) {
183 translate([ bolt_x, 0, min_z + (j + 0.5) * bolt_stride ]) {
184 translate([0, -tube_dia/2, 0])
186 cylinder(r= bolt_hole_r, h= tube_dia);
187 translate([0, -flats_y, 0])
189 cylinder(r= bolt_flat/2, h= tube_dia/2);
195 // ---------- vhook ----------
197 module VHookProfile() {
198 translate([0, -vhook_inside/2 - vhook_th/2])
199 circle(r = vhook_th/2);
202 module VHookHookMain(outer=false){ ////toplevel
204 rotate_extrude(convexity=10)
209 translate([0,-vhook_outer_dia]) square(center=true, vhook_th);
214 module VHookA(){ ////toplevel
217 translate([0, vhook_ctr, 0]){
220 linextr(-0.1, vhook_outer_dia/2)
222 translate([0, -vhook_inside/2 -vhook_th/2, vhook_outer_dia/2])
223 sphere(r= vhook_th/2);
228 VHookHookMain(outer=true);
229 linextr_y_xz(0, vhook_outer_dia/2) hull(){
231 translate([0,-0.1]) square(center=true, [vhook_th, 0.2]);
237 translate([0,0, -vhook_outer_dia])
238 cube(center=true, vhook_outer_dia*2);
242 //translate([0, vhook_y0, 50]) rotate([0,0,-90]) color("black") cube(10);
243 // translate([0,0,-150]) rotate([0,0,180 + theta]) color("blue") cube(100);
246 module VHookPlanDemo(){
248 translate([0, vhook_ctr, 5])
251 color("blue") VHookProfile();
255 // ---------- cleat ----------
257 function cleat_frame_theta(s) = s * cleat_horn_tl / cleat_curve_r * 360/TAU;
258 function cleat_frame_z(s) = cleat_curve_r * (1 - cos(cleat_frame_theta(s)));
259 function cleat_frame_x(s) = cleat_curve_r * sin(cleat_frame_theta(s));
260 function cleat_frame_r(s) = ( cleat_horn_d_min * s +
261 cleat_horn_d_max * (1-s) ) * 0.5;
263 module CleatFrameSphere(r) {
264 scale([1, r[1]/r[0], 1])
268 module CleatFrame(s) {
269 r = cleat_frame_r(s);
270 translate([cleat_frame_x(s), 0, cleat_frame_z(s)])
277 for (si=[0 : cleat_frames-2]) {
278 s0 = si / (cleat_frames-1);
279 s1 = (si+1) / (cleat_frames-1);
288 frames = cleat_frames/2;
289 se = cleat_stem_l/2 / cleat_horn_tl;
290 r = cleat_frame_r(se);
293 for (s = [-se, se]) {
294 for (z= [-(cleat_height + tube_dia/2),
296 translate([cleat_frame_x(s), 0, z])
297 linear_extrude(height=0.1)
298 scale([1, r[1]/r[0]])
305 module VCleatA(){ ////toplevel
308 translate([0, -(main_r + cleat_height), 0]) {
309 rotate([0, -90, 90]) {
320 // ---------- hhook ----------
322 module HHookHookPlan(){
323 translate([0, hhook_ctr]){
325 circle(r = hhook_outer_dia/2);
326 circle(r = hhook_inside/2);
327 rectfromto([+hhook_outer_dia, -hhook_outer_dia],
328 [0, +hhook_outer_dia]);
330 translate([0, -(hhook_inside/2 + hhook_th/2)]){
332 for (x=[-0.1, hhook_l]) {
333 translate([x,0]) square(center=true, hhook_th);
340 module HHookA(){ ////toplevel
342 linextr(min_z, max_z) {
347 module HHookPlanDemo(){
352 // ---------- misc ----------
354 module PinSitu(){ ////toplevel
357 translate([0,0, -pin_head_th])
358 cylinder(r= pin_dia/2, h = total_z + pin_head_th + pin_tail);
360 cylinder(r= hinge_o_r - pin_gap, h = pin_head_th);
362 translate([0,0, total_z + pin_tail/2])
364 translate([0,0, -pin_dia])
365 cylinder(r= pin_hole_dia/2, h=pin_dia*2);
366 translate([pin_dia/2 * cos(45), -50, -pin_head_th*2])
367 cube([50,100, total_z*2]);
371 module Pin(){ ////toplevel
377 module GeneralB(){ ////toplevel
381 module DummyA(){ ////toplevel
385 module PlanDemo(){ ////toplevel
387 translate([0,0,-4]) color("red") Portion(1);
388 translate([0,0,-2]) color("grey") Portion(0);
390 translate([0, tube_dia*1.5]) {
395 translate([0, -tube_dia*1.5]) {
398 translate([tube_dia*4, 0]) {
401 // translate([max_x - hinge_x + 20, 0]) color("blue") MainPlanA();
404 module DemoA(){ DummyA(); }
406 module Demo(){ ////toplevel
407 color("red") rotate([180,0,0]) GeneralB();
408 color("blue") DemoA();
409 color("orange") translate([hinge_x, 0, min_z - hinge_z_gap])
410 rotate([0,0,180]) PinSitu();