-rw-r--r-- | delta.jscad | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/delta.jscad b/delta.jscad index 7c6f35f..8cf6ca6 100644 --- a/delta.jscad +++ b/delta.jscad @@ -451,4 +451,76 @@ function getParameterDefinitions() { var FOURWINDS = [0,90,180,270]; + +var E2020 = { + outer: 20, thickness: 1.8, + roundius: 1, centerhole: 5, + slot_width: 6, + T: { width: 10, thickness: 1.5, depth: 6.5 }, + + extrusion: function(o) { + if(!o) o = {}; + var e = o.extrusion || this; + var l = o.l||5; + var iy = e.outer/2-e.T.depth; + var ix = e.T.width/2-(e.outer/2-iy-e.thickness-e.T.thickness); + var rv = CAG.roundedRectangle({ + corner1: [-e.outer/2,-e.outer/2], corner2: [e.outer/2,e.outer/2], + roundradius: e.roundius + }).subtract( + FOURWINDS.map(function(w) { + return CAG.fromPoints([ + [ e.slot_width/2,e.outer/2+1], + [ e.slot_width/2,e.outer/2-e.thickness], + [ e.T.width/2,e.outer/2-e.thickness], + [ e.T.width/2,e.outer/2-e.thickness-e.T.thickness], + [ ix, iy ], + [ -ix, iy ], + [ -e.T.width/2,e.outer/2-e.thickness-e.T.thickness], + [ -e.T.width/2,e.outer/2-e.thickness], + [ -e.slot_width/2,e.outer/2-e.thickness], + [ -e.slot_width/2,e.outer/2+1], + ]).rotateZ(w); + }) + ).subtract(CAG.circle({ + center: [0,0], radius: e.centerhole/2 + })).extrude({offset:[0,0,l]}); + rv.properties.c_top=rv.properties.c_left + = new CSG.Connector([0,0,l],[0,0,-1],[1,0,0]); + rv.properties.c_bottom=rv.properties.c_right + = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); + rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); + return rv; + }, + + cap: function extrusion_cap(o) { + if(!o) o = {}; + var e = o.extrusion || this; + var thickness = o.thickness||2, l = o.l||5; + var rv = CSG.roundedCube({ + corner1: [-e.outer/2,-e.outer/2,thickness], + corner2: [e.outer/2,e.outer/2,0], + roundradius: [e.roundius,e.roundius,0] + }); + var fw = [0,90,180,270]; // four winds + var iy = e.outer/2-e.T.depth; + var ix = e.T.width/2-(e.outer/2-iy-e.thickness-e.T.thickness); + rv = rv.union(fw.map(function(w) { + return CAG.fromPoints([ + [ e.slot_width/2,e.outer/2], + [ e.slot_width/2,e.outer/2-e.thickness], + [ e.T.width/2,e.outer/2-e.thickness], + [ e.T.width/2,e.outer/2-e.thickness-e.T.thickness], + [ ix, iy ], + [ -ix, iy ], + [ -e.T.width/2,e.outer/2-e.thickness-e.T.thickness], + [ -e.T.width/2,e.outer/2-e.thickness], + [ -e.slot_width/2,e.outer/2-e.thickness], + [ -e.slot_width/2,e.outer/2], + ]).extrude({offset:[0,0,l+thickness]}).rotateZ(w); + })); + rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); + return rv; + } +}; function main(params) { var e = EFFECTOR.effector(); |