From: Ian Jackson Date: Sun, 26 Aug 2012 17:23:00 +0000 (+0100) Subject: cliphook wip - break out FlatArc X-Git-Tag: filamentspool-v2-release~914 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=reprap-play.git;a=commitdiff_plain;h=5149dc140ebb01ef0a8e11f575fb45a8fe68b844;hp=2d5112d86fa08d364980ec15e4282d8fd2c2afae cliphook wip - break out FlatArc --- diff --git a/cliphook.scad b/cliphook.scad index 86a76ba..b1bc988 100644 --- a/cliphook.scad +++ b/cliphook.scad @@ -7,6 +7,29 @@ function ClipHook_xe(w,g,l,ye,k) = sqrt(pow( ClipHook_r3(w,g,l,ye,k), 2) - pow( ClipHook_yd(w,g,l,ye,k) - ye, 2)); +module FlatArc(cx,cy,r1,r2,a1,a2=360) { + astep = (a2-a1)/6; + size = 5*(r2/2); + translate([cx,cy,0]) { + intersection() { + difference() { + circle(r=r2); + translate([0,0,-1]) + circle(r=r1, h=h+2); + } + scale(size) { + for (ai=[0:4]) { + echo(" jarc ", a1,a2, astep, ai, a1 + astep*ai ); + rotate(a1 + astep*ai) { + polygon([ [0,0], [1,0], + [cos(astep*2),sin(astep*2)] ]); + } + } + } + } + } +} + module ClipHook_2D(w,g,l,ye,k,h) { r2 = ClipHook_r2(w,g,l,ye,k); r3 = ClipHook_r3(w,g,l,ye,k); @@ -26,29 +49,7 @@ module ClipHook_2D(w,g,l,ye,k,h) { module jcirc(x,y) { translate([x,y,0]) circle(r=w/2); } module jbox(y,x1,x2) { translate([x1,y-w/2,0]) square(size=[x2-x1, w]); } - module jarc(cx,cy,r,a1=0,a2=360) { - astep = (a2-a1)/6; - size = 5*(r+w/2); - translate([cx,cy,0]) { - intersection() { - difference() { - circle(r=r+w/2); - translate([0,0,-1]) - circle(r=r-w/2, h=h+2); - } - scale(size) { - for (ai=[0:4]) { - echo(" jarc ", a1,a2, astep, ai, a1 + astep*ai ); - rotate(a1 + astep*ai) { - polygon([ [0,0], [1,0], - [cos(astep*2),sin(astep*2)] ]); - } - } - } - } - } - } - + module jarc(cx,cy,r,a1=0,a2=360) { FlatArc(cx,cy,r-w/2,r+w/2,a1,a2); } jcirc(-xc, -yc); jbox(-yc, xc, -xc);