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) (unidiff)
treeab38c1991fd83aa7f99c2bf0ac9a3c20a7ef8e07
parentbfc4a5d491d06a2300915abd3eb356c5656611ee (diff)
downloadredelta-adcd18d64550c932814ed6c37c346e781920e640.zip
redelta-adcd18d64550c932814ed6c37c346e781920e640.tar.gz
redelta-adcd18d64550c932814ed6c37c346e781920e640.tar.bz2
2020 extrusion
Diffstat (more/less context) (ignore 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
@@ -451,4 +451,76 @@ function getParameterDefinitions() {
451 451
452var FOURWINDS = [0,90,180,270]; 452var FOURWINDS = [0,90,180,270];
453
454var E2020 = {
455 outer: 20, thickness: 1.8,
456 roundius: 1, centerhole: 5,
457 slot_width: 6,
458 T: { width: 10, thickness: 1.5, depth: 6.5 },
459
460 extrusion: function(o) {
461 if(!o) o = {};
462 var e = o.extrusion || this;
463 var l = o.l||5;
464 var iy = e.outer/2-e.T.depth;
465 var ix = e.T.width/2-(e.outer/2-iy-e.thickness-e.T.thickness);
466 var rv = CAG.roundedRectangle({
467 corner1: [-e.outer/2,-e.outer/2], corner2: [e.outer/2,e.outer/2],
468 roundradius: e.roundius
469 }).subtract(
470 FOURWINDS.map(function(w) {
471 return CAG.fromPoints([
472 [ e.slot_width/2,e.outer/2+1],
473 [ e.slot_width/2,e.outer/2-e.thickness],
474 [ e.T.width/2,e.outer/2-e.thickness],
475 [ e.T.width/2,e.outer/2-e.thickness-e.T.thickness],
476 [ ix, iy ],
477 [ -ix, iy ],
478 [ -e.T.width/2,e.outer/2-e.thickness-e.T.thickness],
479 [ -e.T.width/2,e.outer/2-e.thickness],
480 [ -e.slot_width/2,e.outer/2-e.thickness],
481 [ -e.slot_width/2,e.outer/2+1],
482 ]).rotateZ(w);
483 })
484 ).subtract(CAG.circle({
485 center: [0,0], radius: e.centerhole/2
486 })).extrude({offset:[0,0,l]});
487 rv.properties.c_top=rv.properties.c_left
488 = new CSG.Connector([0,0,l],[0,0,-1],[1,0,0]);
489 rv.properties.c_bottom=rv.properties.c_right
490 = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]);
491 rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]);
492 return rv;
493 },
494
495 cap: function extrusion_cap(o) {
496 if(!o) o = {};
497 var e = o.extrusion || this;
498 var thickness = o.thickness||2, l = o.l||5;
499 var rv = CSG.roundedCube({
500 corner1: [-e.outer/2,-e.outer/2,thickness],
501 corner2: [e.outer/2,e.outer/2,0],
502 roundradius: [e.roundius,e.roundius,0]
503 });
504 var fw = [0,90,180,270]; // four winds
505 var iy = e.outer/2-e.T.depth;
506 var ix = e.T.width/2-(e.outer/2-iy-e.thickness-e.T.thickness);
507 rv = rv.union(fw.map(function(w) {
508 return CAG.fromPoints([
509 [ e.slot_width/2,e.outer/2],
510 [ e.slot_width/2,e.outer/2-e.thickness],
511 [ e.T.width/2,e.outer/2-e.thickness],
512 [ e.T.width/2,e.outer/2-e.thickness-e.T.thickness],
513 [ ix, iy ],
514 [ -ix, iy ],
515 [ -e.T.width/2,e.outer/2-e.thickness-e.T.thickness],
516 [ -e.T.width/2,e.outer/2-e.thickness],
517 [ -e.slot_width/2,e.outer/2-e.thickness],
518 [ -e.slot_width/2,e.outer/2],
519 ]).extrude({offset:[0,0,l+thickness]}).rotateZ(w);
520 }));
521 rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]);
522 return rv;
523 }
524};
453function main(params) { 525function main(params) {
454 var e = EFFECTOR.effector(); 526 var e = EFFECTOR.effector();