chiark / gitweb /
much pins
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 5 Nov 2017 20:16:28 +0000 (20:16 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 5 Nov 2017 20:16:28 +0000 (20:16 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
moebius-demo.scad

index fb2821de1f37669d6ee97cc692c1469ecdb0b7ab..6bbf568cd4a431230a477468430749f87ab358ec 100644 (file)
@@ -8,9 +8,15 @@ pin_stemwidth = 1.5;
 pin_stemlen = 1.5;
 pin_headwidth = 3.0;
 pin_headheight = 1.0;
-pin_xslop = 0.25;
+pin_slot_xslop = 0.25;
 
-pin_yadj_range = [ -0.5, +0.5 ];
+pin_yadj_range = [ -0.75, +0.5 ];
+pin_yslop = 0.25;
+
+pin_pin_xslop = 0.00;
+pin_pin_yadj_range = pin_yadj_range + [ 0.00, 0.00 ];
+
+pin_height = 5;
 
 // computed
 
@@ -33,15 +39,16 @@ module HalfPinHeadProfile(xslop, yadj, lenadj) {
                pin_stemlen/2 + yadj + (pin_headwidth - pin_stemwidth)/2 ])
       square([ tw, th ]);
     translate([ -sw/2,
-               pin_stemlen/2 ])
+               pin_stemlen/2 + yadj ])
       square([ sw, th ]);
   }
 }
 
-module PinStemProfile(xslop) {
+module PinStemProfile(xslop, yadj) {
+  sl = pin_stemlen + pin_headheight/2 + max(yadj * 2, 0);
   square(center=true,
         [ pin_stemwidth + xslop*2,
-          pin_stemlen + pin_headheight/2 ]);
+          sl ]);
 }
 
 module PinExtrudePortion(zi,zrange){
@@ -50,25 +57,44 @@ module PinExtrudePortion(zi,zrange){
     linear_extrude(height=0.1)
     children(0);
 }
-    
+
 module PinExtrude(zrange,
-                 xslop=[0,0], yadj=[0,0], lenadj=[0,0], len1adj=[0,0]){
-  for (ml= [[0, lenadj], [1, len1adj]]) {
-    mirror([0,ml[0]]){
+                 xslop=0,
+                 yadjs=[[0,0], [0,0]], // [top[], bottom[]]
+                 lenadjs=[0,0]){ // in each case: zrange[0],zrange[1]
+  for (topboti=[0,1]) {
+    mirror([0,topboti,0]){
       hull(){
        for (zi=[0,1])
          PinExtrudePortion(zi,zrange)
-           HalfPinHeadProfile(xslop[zi], yadj[zi], ml[1][zi]);
+           HalfPinHeadProfile(xslop, yadjs[topboti][zi], lenadjs[zi]);
       }
     }
   }
   hull(){
     for (zi=[0,1])
       PinExtrudePortion(zi,zrange)
-       PinStemProfile(xslop[zi]);
+       PinStemProfile(xslop, max(yadjs[zi][0], yadjs[zi][1]));
   }
 }
 
+module PinCutout(){
+  PinExtrude([-10,10],
+            xslop= pin_slot_xslop,
+            yadjs = [ [0,0],
+                      [1,1] * -pin_stemlen/2 ],
+            // bigger gap in -ve y direction
+            lenadjs = [1,1] * (pin_yslop + pin_yadj_range[1]) );
+}
+
+module Pin(){
+  PinExtrude([-0.5, 0.5] * pin_height,
+            xslop = pin_pin_xslop,
+            yadjs = [pin_pin_yadj_range, pin_pin_yadj_range],
+            lenadjs = [1,1] * pin_yadj_range[1]
+            );
+}
+
 module PinDemo(){
   for (i=[0,1]) {
     hull(){
@@ -83,4 +109,7 @@ module PinDemo(){
 
 //MainBody();
 //%PinDemo();
-PinExtrude([-2,10]);
+//PinExtrude([-2,10]);
+//PinCutout();
+Pin();
+%PinCutout();