summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2016-01-06 21:41:21 (UTC)
committer Michael Krelin <hacker@klever.net>2016-01-06 21:41:21 (UTC)
commitadcd18d64550c932814ed6c37c346e781920e640 (patch) (side-by-side diff)
treeab38c1991fd83aa7f99c2bf0ac9a3c20a7ef8e07
parentbfc4a5d491d06a2300915abd3eb356c5656611ee (diff)
downloadredelta-adcd18d64550c932814ed6c37c346e781920e640.zip
redelta-adcd18d64550c932814ed6c37c346e781920e640.tar.gz
redelta-adcd18d64550c932814ed6c37c346e781920e640.tar.bz2
2020 extrusion
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--delta.jscad72
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
@@ -450,6 +450,78 @@ 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();
var hs = E3DV6.heatsink();