-rw-r--r-- | snapper.scad | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/snapper.scad b/snapper.scad new file mode 100644 index 0000000..0c258ca --- a/dev/null +++ b/snapper.scad @@ -0,0 +1,27 @@ +/* d - diameter, o - overlap (fraction) */ +function snapper_apart(d,o) = d*(1-o); +module snapper(d,o,l=-1,side=0) { + snapper_apart = d*(1-o); + l_ = (l<0) ? d : l; + lw = d/2; + sfn = 8*d; + module lm() { + translate([-lw/2,0,0]) hull() { + cube(size=[lw,l_-d/2,d]); + translate([lw/2,l_,0]) cylinder(d=d/8,h=d,$fn=sfn); + } + } + if(side==0) { + translate([0,l_,d/2]) sphere(d=d,$fn=sfn); + lm(); + }else if(side==1) { + difference() { + for(x=[-1,1]) translate([x*snapper_apart(d,o),0,0]) { + translate([0,l_,d/2]) sphere(d=d,$fn=sfn); + lm(); + } + translate([0,l_,d/2]) sphere(d=d,$fn=sfn); + } + }else + echo("ERROR: what side?"); +} |