From 406d2412f60c240369a3977282a928a4339e49d7 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 5 Nov 2017 19:53:11 +0000 Subject: [PATCH] wip pins Signed-off-by: Ian Jackson --- moebius-demo.scad | 62 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) diff --git a/moebius-demo.scad b/moebius-demo.scad index 98b8469..fb2821d 100644 --- a/moebius-demo.scad +++ b/moebius-demo.scad @@ -2,6 +2,18 @@ include +// 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]); -- 2.30.2