X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=reprap-play.git;a=blobdiff_plain;f=lock-inframe-bracket.scad;h=376662eb0d55bcab7b0f8c5e8b70e6cf9ae53dc1;hp=5b14c9d321d47ebc1103cb09e727689f0afa8759;hb=156db7e3f7e1588b02761647901279164869bbf8;hpb=6c5eea64f002a2e610bcabd9026b869ab3544a4e diff --git a/lock-inframe-bracket.scad b/lock-inframe-bracket.scad index 5b14c9d..376662e 100644 --- a/lock-inframe-bracket.scad +++ b/lock-inframe-bracket.scad @@ -1,24 +1,65 @@ // -*- C -*- -tube_dia = 27.5 + 0.5; +// use shell thickness 1.50 +// use fill density 40% + +include + +tube_dia = 27.5 + 1.625; lock_w = 42.5 + 0.5; lock_d = 28.0 + 0.5; main_h = 45.0; backflange_d = 12; +lockshaft_dia = 14.35; + +cliprecess_h = 16; +total_h = 45; + +back_gap = 12.5; +main_th = 3.50; +tube_th = 4.00; -back_gap = 7; -main_th = 2.5; midweb_d = 3; +clip_th = 3.5; +clip_gap = 2.5; +clip_d = 22.0; + +mountscrew_dia = 4 + 0.5; +clipbolt_dia = 5 + 0.6; + +backflange_th = 4.5; + +$fn=50; + +join_cr = 9; + +tube_rear_extra_th = 1; + +divide_shaft_w = 1.75; +divide_shaft_l = 1.5; +divide_head_dx = 1.75; +divide_head_th = 1.5; +divide_gap = 0.50; +divide_heads = 2; + +divide_angle = 26; +divide_fudge_r = 4.75; +divide_around = 3.5; + +backflange_angle = 20; // calculated +lockshaft_r = [1, 1] * lockshaft_dia / 2; front_th = main_th; -tube_or = tube_dia/2 + main_th; -back_ohw = back_gap/2 + main_th; +tube_or = tube_dia/2 + tube_th; +back_ohw = back_gap/2 + backflange_th; backflange_ymin = tube_or+backflange_d; lock_0y = tube_dia/2 + lock_d/2 + midweb_d; +lock_0x = lock_w/2 - lock_d/2; +lock_0 = [lock_0x,lock_0y]; lock_or = [lock_w, lock_d]/2 + [front_th,front_th]; @@ -33,25 +74,209 @@ module oval(sz){ // sz[0] > sz[1] } } +module JoinCircs(jr){ + // http://mathworld.wolfram.com/Circle-CircleIntersection.html + R = tube_or + join_cr; + r = lock_or[1] + join_cr; + d = dist2d( [0,0], lock_0 ); + x = (d*d - r*r + R*R) / (2*d); + y = sqrt( R*R - x*x ); + + echo(lock_0x, lock_0y, R,r, d, x,y); + + for (m=[0,1]) { + mirror([m,0]) { + rotate(atan2(lock_0y, lock_0x)) { + translate([x,-y]) + circle(r= jr); + } + } + } +} + +module DividePlan(xl=10){ + w = divide_shaft_w; + g = divide_gap; + l = divide_shaft_l + g; + t = divide_head_th + g; + dx = divide_head_dx; + for (m=[0,1]) mirror([m,0]) { + translate([w, 0]) square([xl, g]); + for (i=[0:divide_heads-1]) { + translate([w, i*(l + t)]) { + translate([0, 0]) square([g, l + g]); + translate([0, l]) square([divide_head_dx + g, g]); + translate([dx, l]) square([g, t + g]); + translate([0, l + t]) + square([divide_head_dx + g, g]); + } + } + translate([-0.1, (l + t) * divide_heads]) + square([w + g, g]); + } +} + +module DividePlanInPlace(xl=10){ + rotate([0,0, -divide_angle]) + translate([ -tube_dia/2 -tube_th/2 - divide_fudge_r, 0]) + DividePlan(xl); +} + module MainPlan(){ difference(){ union(){ - circle(r = tube_or); - translate([-back_ohw,0]) mirror([0,1]) - square([back_ohw*2, backflange_ymin]); + difference(){ + union(){ + hull(){ + for (t=[0, tube_rear_extra_th]) + translate([0, -t]) + circle(r = tube_or); + } + rotate([0,0, backflange_angle]) + translate([-back_ohw,0]) mirror([0,1]) + square([back_ohw*2, backflange_ymin]); + + translate([0, lock_0y]){ + oval(lock_or); + } + + hull(){ + JoinCircs(0.01); + polygon([[0,0], lock_0, [-lock_0[0], lock_0[1]]]); + } + } + + rotate([0,0, backflange_angle]) + translate([-back_gap/2,1]) mirror([0,1]) + square([back_gap, backflange_ymin+2]); + + JoinCircs(join_cr); + } + + hull(){ + minkowski(){ + DividePlanInPlace(0.1); + circle(divide_around); + } + } + } + translate([0, lock_0y]){ + oval([lock_w/2, lock_d/2]); } + circle(r = tube_dia/2); - translate([-back_gap/2,1]) mirror([0,1]) - square([back_gap, backflange_ymin+2]); + + DividePlanInPlace(); } - translate([0, lock_0y]){ - difference(){ - union(){ - oval(lock_or); - } - oval([lock_w/2, lock_d/2]); +} + +lockshaft_or = lockshaft_r + [clip_th,clip_th]; +cliprecess_ymax = cliprecess_h - lockshaft_r[1]; +clip_ymin = cliprecess_ymax - total_h; +clip_ogap = clip_gap + clip_th*2; + +module ClipElevationPositive(){ + hull(){ + oval(lockshaft_or); + translate([0, -lockshaft_or[1] * sqrt(2)]) + square(center=true, 0.5); + } + translate([-lockshaft_or[0], 0]) + square([lockshaft_or[0]*2, cliprecess_ymax]); + translate([-clip_ogap/2, 0]) mirror([0,1]) square([clip_ogap, -clip_ymin]); +} + +module ClipElevationNegative(){ + hull(){ + for (y=[0, cliprecess_ymax+1]) + translate([0, y]) + oval(lockshaft_r); + } + translate([-clip_gap/2, 1]) mirror([0,1]) square([clip_gap, 2-clip_ymin]); +} + +module ClipElevation(){ + difference(){ + ClipElevationPositive(1); + ClipElevationNegative(0); + } +} + +module ExtrudeClipElevation(extra=0){ + translate([0, + lock_0y + lock_d/2 + clip_d + extra, + -clip_ymin]) + rotate([90,0,0]) + linear_extrude(height= clip_d + extra*2, convexity=100) + children(0); +} + +module ThroughHole(r, y, z) { + translate([-50, y, z]) + rotate([0, 90, 0]) + cylinder(r=r, h=100, $fn=20); +} + +module ThroughHoles(){ + for (z=[ 1/4, 3/4 ]) { + ThroughHole( mountscrew_dia/2, + -tube_or -0.5*backflange_d, + total_h * z ); + } + + ThroughHole( clipbolt_dia/2, + lock_0y + lock_d/2 + clip_d/2 + front_th/2, + total_h - cliprecess_h - clip_th - clip_d/2 ); +} + +module MainPositive(){ + difference(){ + union(){ + linear_extrude(height=total_h, convexity=100) MainPlan(); + ExtrudeClipElevation() ClipElevationPositive(); } + ExtrudeClipElevation(1) ClipElevationNegative(); } } -MainPlan(); +module Bracket(){ ////toplevel + difference(){ + MainPositive(); + ThroughHoles(); + } +} + +module TestTopEdge(){ ////toplevel + intersection(){ + translate([0,0, -total_h]) + translate([0,0, 4]) + Bracket(); + translate([-200,-200,0]) + cube([400,400,100]); + } +} + +module TestClipBoltHole(){ ////toplevel + intersection(){ + union(){ + translate([0, 0, -5]) + Bracket(); + translate([-4, lock_0y + lock_d/2 + 1, 0]) + cube([8, 4, 1.5]); + } + translate([-200, lock_0y + lock_d/2 + 0.1]) + cube([400, 400, total_h-20]); + } +} + +//MainPlan(); +//ClipElevationPositive(); +//ClipElevation(); +//MainPositive(); +//%ThroughHoles(); +//TestTopEdge(); +//TestClipBoltHole(); +//DividePlan(); + +//Bracket(); +