summaryrefslogtreecommitdiffabout
path: root/snapper.scad
authorMichael Krelin <hacker@klever.net>2016-05-27 13:27:38 (UTC)
committer Michael Krelin <hacker@klever.net>2016-05-27 19:40:59 (UTC)
commitead35d4dd76ff079399b9ac6272fa86d3b23a2dc (patch) (side-by-side diff)
tree966ca9d57989a6b380b67b05c688407e7163bec2 /snapper.scad
downloadfanductory-ead35d4dd76ff079399b9ac6272fa86d3b23a2dc.zip
fanductory-ead35d4dd76ff079399b9ac6272fa86d3b23a2dc.tar.gz
fanductory-ead35d4dd76ff079399b9ac6272fa86d3b23a2dc.tar.bz2
initial import
Diffstat (limited to 'snapper.scad') (more/less context) (ignore whitespace changes)
-rw-r--r--snapper.scad27
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?");
+}