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

index 98b84699665f1dc79ae4d7af588e1638208130cf..fb2821de1f37669d6ee97cc692c1469ecdb0b7ab 100644 (file)
@@ -2,6 +2,18 @@
 
 include <moebius-core.scad>
 
+// settings etc.
+
+pin_stemwidth = 1.5;
+pin_stemlen = 1.5;
+pin_headwidth = 3.0;
+pin_headheight = 1.0;
+pin_xslop = 0.25;
+
+pin_yadj_range = [ -0.5, +0.5 ];
+
+// computed
+
 sliceat = moebiuscore_sliceat * moebiuscore_nomsize;
 
 module MainBody(){
@@ -12,6 +24,51 @@ module MainBody(){
   }
 }
 
+module HalfPinHeadProfile(xslop, yadj, lenadj) {
+  sw = pin_stemwidth + xslop*2;
+  tw = pin_headwidth + xslop*2;
+  th = pin_headheight + lenadj - yadj;
+  hull(){
+    translate([ -tw/2,
+               pin_stemlen/2 + yadj + (pin_headwidth - pin_stemwidth)/2 ])
+      square([ tw, th ]);
+    translate([ -sw/2,
+               pin_stemlen/2 ])
+      square([ sw, th ]);
+  }
+}
+
+module PinStemProfile(xslop) {
+  square(center=true,
+        [ pin_stemwidth + xslop*2,
+          pin_stemlen + pin_headheight/2 ]);
+}
+
+module PinExtrudePortion(zi,zrange){
+  translate([0,0,zrange[zi]])
+    mirror([0,0,zi])
+    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]]){
+      hull(){
+       for (zi=[0,1])
+         PinExtrudePortion(zi,zrange)
+           HalfPinHeadProfile(xslop[zi], yadj[zi], ml[1][zi]);
+      }
+    }
+  }
+  hull(){
+    for (zi=[0,1])
+      PinExtrudePortion(zi,zrange)
+       PinStemProfile(xslop[zi]);
+  }
+}
+
 module PinDemo(){
   for (i=[0,1]) {
     hull(){
@@ -24,5 +81,6 @@ module PinDemo(){
   }
 }
 
-MainBody();
-%PinDemo();
+//MainBody();
+//%PinDemo();
+PinExtrude([-2,10]);