chiark / gitweb /
cliphook: cupcap, conditional demo
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 28 Aug 2012 17:33:39 +0000 (18:33 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 28 Aug 2012 17:33:39 +0000 (18:33 +0100)
cliphook.scad

index f4231b3083eb11f78a69fad435d3f0a0f645e08a..2d29506e145931836d0025de54cb7aaed076eea7 100644 (file)
@@ -59,12 +59,26 @@ module ClipHook_2D(w,g,l,ye,k,h) {
   jcirc(xe,ye);
 }
 
-module ClipHook(w=1.2, g=0.2, l=0.0, ye=0, k=2.0, h=3.5, demo=false) {
-  linear_extrude(height=h)
-    ClipHook_2D(w,g,l,ye,k);
-  if (demo)
-    %linear_extrude(height=h)
-      translate([l+w,0,0]) rotate(180) ClipHook_2D(w,g,l,ye,k);
+module ClipHook(w=1.2, g=0.2, l=0.0, ye=0, k=2.0, h=3.5, demo=false,
+               cupcaph=0, cupgapg=0) {
+  difference() {
+    linear_extrude(height=h)
+      ClipHook_2D(w,g,l,ye,k);
+    if (cupcapg != 0) {
+      translate([0,-(w+g),h-cupcaph])
+      cube([w,(w+g),cupcaph+1]);
+    }
+  }
+  if (cupcaph != 0) {
+    translate([-l/2, g/2+w/2, h-0.01])
+      intersection() {
+        cylinder(r=ClipHook_r2(w,g,l,ye,k)+w/2, h=cupcaph, $fn=16);
+       translate([-50-g,-50,-1]) cube([50,100,h+2]);
+      }
+  }
 }
 
-//ClipHook(l=3, ye=1.5, k=1, demo=true);
+if (ClipHook_demo) {
+  ClipHook(l=0, k=1, cupcaph=1, cupcapg=0.4);
+  %translate([l+w,0,0]) rotate(180) ClipHook(l=0, k=1, cupcaph=1, cupcapg=0.4);
+}