summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--delta.jscad11
1 files changed, 11 insertions, 0 deletions
diff --git a/delta.jscad b/delta.jscad
index 9c13528..ad19f88 100644
--- a/delta.jscad
+++ b/delta.jscad
@@ -530,201 +530,212 @@ var E2020 = {
530 [ e.T.width/2,e.outer/2-e.thickness], 530 [ e.T.width/2,e.outer/2-e.thickness],
531 [ e.T.width/2,e.outer/2-e.thickness-e.T.thickness], 531 [ e.T.width/2,e.outer/2-e.thickness-e.T.thickness],
532 [ ix, iy ], 532 [ ix, iy ],
533 [ -ix, iy ], 533 [ -ix, iy ],
534 [ -e.T.width/2,e.outer/2-e.thickness-e.T.thickness], 534 [ -e.T.width/2,e.outer/2-e.thickness-e.T.thickness],
535 [ -e.T.width/2,e.outer/2-e.thickness], 535 [ -e.T.width/2,e.outer/2-e.thickness],
536 [ -e.slot_width/2,e.outer/2-e.thickness], 536 [ -e.slot_width/2,e.outer/2-e.thickness],
537 [ -e.slot_width/2,e.outer/2], 537 [ -e.slot_width/2,e.outer/2],
538 ]).extrude({offset:[0,0,l+thickness]}).rotateZ(w); 538 ]).extrude({offset:[0,0,l+thickness]}).rotateZ(w);
539 })); 539 }));
540 rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); 540 rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]);
541 return rv; 541 return rv;
542 } 542 }
543}; 543};
544 544
545var THREEWINDS = [0,120,240]; 545var THREEWINDS = [0,120,240];
546 546
547function base_sides() { 547function base_sides() {
548 return [0,1].map(function(l) { 548 return [0,1].map(function(l) {
549 return THREEWINDS.map(function(w) { 549 return THREEWINDS.map(function(w) {
550 var e = E2020.extrusion({l:CONFIG.base.el}); 550 var e = E2020.extrusion({l:CONFIG.base.el});
551 e = e.connectTo(e.properties.c_midway, 551 e = e.connectTo(e.properties.c_midway,
552 new CSG.Connector([0,-CD.base.mid_inscription_r,CONFIG.extrusion.w/2],[1,0,0],[0,0,1]), 552 new CSG.Connector([0,-CD.base.mid_inscription_r,CONFIG.extrusion.w/2],[1,0,0],[0,0,1]),
553 false, 0); 553 false, 0);
554 return ( e.translate([0,0,CONFIG.foot.h+l*(CONFIG.extrusion.w+CONFIG.base.gap)]) 554 return ( e.translate([0,0,CONFIG.foot.h+l*(CONFIG.extrusion.w+CONFIG.base.gap)])
555 .rotateZ(w) 555 .rotateZ(w)
556 .setColor(CONFIG.color.extrusion) ); 556 .setColor(CONFIG.color.extrusion) );
557 }); 557 });
558 }); 558 });
559} 559}
560function base_extrusions() { 560function base_extrusions() {
561 var rv = union( base_sides().map(function(x){return union(x)}) ); 561 var rv = union( base_sides().map(function(x){return union(x)}) );
562 rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); 562 rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]);
563 return rv; 563 return rv;
564} 564}
565 565
566function columns() { 566function columns() {
567 return THREEWINDS.map(function(w) { 567 return THREEWINDS.map(function(w) {
568 return (E2020.extrusion({l:CONFIG.column.h}) 568 return (E2020.extrusion({l:CONFIG.column.h})
569 .translate([0,CD.base.column_r,CONFIG.foot.h]) 569 .translate([0,CD.base.column_r,CONFIG.foot.h])
570 .rotateZ(w).setColor(CONFIG.color.extrusion) 570 .rotateZ(w).setColor(CONFIG.color.extrusion)
571 ); 571 );
572 }); 572 });
573} 573}
574function column_extrusions() { 574function column_extrusions() {
575 var rv = union( columns() ); 575 var rv = union( columns() );
576 rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); 576 rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]);
577 return rv; 577 return rv;
578} 578}
579 579
580function duet() { 580function duet() {
581 var C = CONFIG.duet; 581 var C = CONFIG.duet;
582 var pholes = new CSG.Properties(); 582 var pholes = new CSG.Properties();
583 var hx = C.hole_spacing.x/2; 583 var hx = C.hole_spacing.x/2;
584 var hy = C.hole_spacing.y/2; 584 var hy = C.hole_spacing.y/2;
585 var hh = { nw: [1,-1], ne: [1,1], se: [-1,1], sw: [-1,-1] }; 585 var hh = { nw: [1,-1], ne: [1,1], se: [-1,1], sw: [-1,-1] };
586 var holes = []; 586 var holes = [];
587 for(w in hh) { 587 for(w in hh) {
588 var h = hh[w],_x=h[0]*hx,_y=h[1]*hy; 588 var h = hh[w],_x=h[0]*hx,_y=h[1]*hy;
589 holes.push(CSG.cylinder({start:[_x,_y,-1],end:[_x,_y,C.pcb_size.z+1],radius:3/2})); 589 holes.push(CSG.cylinder({start:[_x,_y,-1],end:[_x,_y,C.pcb_size.z+1],radius:3/2}));
590 pholes['c_'+w] = new CSG.Connector([_x,_y,0],[0,0,1],[1,0,0]); 590 pholes['c_'+w] = new CSG.Connector([_x,_y,0],[0,0,1],[1,0,0]);
591 } 591 }
592 rv = CSG.cube({ 592 rv = CSG.cube({
593 corner1: [-C.pcb_size.x/2, -C.pcb_size.y/2, 0], 593 corner1: [-C.pcb_size.x/2, -C.pcb_size.y/2, 0],
594 corner2: [ C.pcb_size.x/2, C.pcb_size.y/2, C.pcb_size.z] 594 corner2: [ C.pcb_size.x/2, C.pcb_size.y/2, C.pcb_size.z]
595 }).subtract(holes).setColor(CONFIG.color.pcb).union( 595 }).subtract(holes).setColor(CONFIG.color.pcb).union(
596 CSG.cube({ 596 CSG.cube({
597 corner1: [-C.pcb_size.x/2,-C.hole_spacing.y/2+3,C.pcb_size.z], 597 corner1: [-C.pcb_size.x/2,-C.hole_spacing.y/2+3,C.pcb_size.z],
598 corner2: [ C.pcb_size.x/2, C.hole_spacing.y/2-3,C.h] 598 corner2: [ C.pcb_size.x/2, C.hole_spacing.y/2-3,C.h]
599 }).setColor(CONFIG.color.bulk) 599 }).setColor(CONFIG.color.bulk)
600 ); 600 );
601 rv.properties.holes = pholes; 601 rv.properties.holes = pholes;
602 rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); 602 rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]);
603 rv.properties.vitamin = true; 603 rv.properties.vitamin = true;
604 return rv; 604 return rv;
605} 605}
606 606
607function foot() { 607function foot() {
608 var F = CONFIG.foot; 608 var F = CONFIG.foot;
609 var br = F.bolt.hd/2+F.margin; 609 var br = F.bolt.hd/2+F.margin;
610 var bh = F.zscalefactor*Math.sqrt(Math.pow(F.d/2,2)-Math.pow(br,2)); 610 var bh = F.zscalefactor*Math.sqrt(Math.pow(F.d/2,2)-Math.pow(br,2));
611 var th = F.h-bh; 611 var th = F.h-bh;
612 var r = 2*F.d; 612 var r = 2*F.d;
613 var rv = CSG.sphere({ // botom contorted sphere 613 var rv = CSG.sphere({ // botom contorted sphere
614 center: [0,0,0], radius: F.d/2, resolution: r 614 center: [0,0,0], radius: F.d/2, resolution: r
615 }).scale([1,1,F.zscalefactor]).translate([0,0,bh]).union(CSG.cylinder({ // top hat 615 }).scale([1,1,F.zscalefactor]).translate([0,0,bh]).union(CSG.cylinder({ // top hat
616 start: [0,0,bh], end: [0,0,F.h], radius: F.d/2, resolution: r 616 start: [0,0,bh], end: [0,0,F.h], radius: F.d/2, resolution: r
617 })).intersect(CSG.cylinder({ // cut off excess 617 })).intersect(CSG.cylinder({ // cut off excess
618 start: [0,0,0], end: [0,0,F.h], radius: F.d 618 start: [0,0,0], end: [0,0,F.h], radius: F.d
619 })).subtract([ 619 })).subtract([
620 CSG.cylinder({ // bolt hole 620 CSG.cylinder({ // bolt hole
621 start: [0,0,-1], end: [0,0,F.h+1], radius: F.bolt.d/2+PRINT.slide_tolerance 621 start: [0,0,-1], end: [0,0,F.h+1], radius: F.bolt.d/2+PRINT.slide_tolerance
622 }), CSG.cylinder({ // nut hole 622 }), CSG.cylinder({ // nut hole
623 start: [0,0,F.h-F.nut.h-PRINT.play_tolerance], 623 start: [0,0,F.h-F.nut.h-PRINT.play_tolerance],
624 end: [0,0,F.h], 624 end: [0,0,F.h],
625 radius: F.nut.d/2+PRINT.slide_tolerance, resolution: 6 625 radius: F.nut.d/2+PRINT.slide_tolerance, resolution: 6
626 }), CSG.cylinder({ // bolthead/washer hole 626 }), CSG.cylinder({ // bolthead/washer hole
627 start: [0,0,-1], end: [0,0,F.h-F.nut.h-PRINT.play_tolerance-F.shell], 627 start: [0,0,-1], end: [0,0,F.h-F.nut.h-PRINT.play_tolerance-F.shell],
628 radius: F.bolt.hd/2+PRINT.play_tolerance 628 radius: F.bolt.hd/2+PRINT.play_tolerance
629 }) 629 })
630 ]).union(CSG.cylinder({ // bridging patch 630 ]).union(CSG.cylinder({ // bridging patch
631 start: [0,0,F.h-F.nut.h-PRINT.play_tolerance-PRINT.layer_height], 631 start: [0,0,F.h-F.nut.h-PRINT.play_tolerance-PRINT.layer_height],
632 end: [0,0,F.h-F.nut.h-PRINT.play_tolerance], 632 end: [0,0,F.h-F.nut.h-PRINT.play_tolerance],
633 radius: F.nut.d/2 633 radius: F.nut.d/2
634 })); 634 }));
635 rv.properties.c_column = new CSG.Connector([0,0,F.h],[0,0,1],[1,0,0]); 635 rv.properties.c_column = new CSG.Connector([0,0,F.h],[0,0,1],[1,0,0]);
636 rv.properties.P = new CSG.Connector([0,0,F.h],[0,0,-1],[1,0,0]); 636 rv.properties.P = new CSG.Connector([0,0,F.h],[0,0,-1],[1,0,0]);
637 return rv.setColor(CONFIG.color.parts); 637 return rv.setColor(CONFIG.color.parts);
638} 638}
639 639
640function refaxes(o) { 640function refaxes(o) {
641 if(!o) o = {}; 641 if(!o) o = {};
642 var l = o.l||20, g = o.g||0.7; 642 var l = o.l||20, g = o.g||0.7;
643 return union([ 643 return union([
644 CSG.roundedCylinder({start:[0,0,0],end:[l,0,0]}).setColor([1,0,0,g]), 644 CSG.roundedCylinder({start:[0,0,0],end:[l,0,0]}).setColor([1,0,0,g]),
645 CSG.roundedCylinder({start:[0,0,0],end:[0,l,0]}).setColor([0,1,0,g]), 645 CSG.roundedCylinder({start:[0,0,0],end:[0,l,0]}).setColor([0,1,0,g]),
646 CSG.roundedCylinder({start:[0,0,0],end:[0,0,l]}).setColor([0,0,1,g]) 646 CSG.roundedCylinder({start:[0,0,0],end:[0,0,l]}).setColor([0,0,1,g])
647 ]); 647 ]);
648} 648}
649 649
650function P(x) { 650function P(x) {
651 return x.connectTo(x.properties.P,new CSG.Connector([0,0,0],[0,0,1],[1,0,0]), false, 0); 651 return x.connectTo(x.properties.P,new CSG.Connector([0,0,0],[0,0,1],[1,0,0]), false, 0);
652} 652}
653 653
654var PARTS = { 654var PARTS = {
655 wip: function(params) { 655 wip: function(params) {
656 return foot(); 656 return foot();
657 return union(base_extrusions(),column_extrusions(),duet()); 657 return union(base_extrusions(),column_extrusions(),duet());
658 alltogethernow: function(params) {
659 var cols = columns();
660 var sides = base_sides();
661 var feet = THREEWINDS.map(function(w,i) {
662 var rv = foot();
663 rv = rv.connectTo(rv.properties.c_column,cols[i].properties.c_bottom,false,0);
664 return rv;
665 });
666 var rv = union(cols).union(sides.map(union)).union(feet);
667 rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]);
668 return rv;
658 } 669 }
659}; 670};
660 671
661function main(params) { 672function main(params) {
662 var part = params.part && PARTS[params.part]; 673 var part = params.part && PARTS[params.part];
663 if(!part) return refaxes(); 674 if(!part) return refaxes();
664 var rv = P(part(params)); 675 var rv = P(part(params));
665 if(!params.print) rv = rv.union(refaxes()); 676 if(!params.print) rv = rv.union(refaxes());
666 return rv; 677 return rv;
667} 678}
668 679
669function _main(params) { 680function _main(params) {
670 var e = EFFECTOR.effector(); 681 var e = EFFECTOR.effector();
671 var hs = E3DV6.heatsink(); 682 var hs = E3DV6.heatsink();
672 hs = hs.connectTo(hs.properties.grove_connector,e.properties.grove_connector,false,0); 683 hs = hs.connectTo(hs.properties.grove_connector,e.properties.grove_connector,false,0);
673 var ms = microswitch(); 684 var ms = microswitch();
674 var hd = EFFECTOR.hinged({ 685 var hd = EFFECTOR.hinged({
675 microswitch:ms,effector:e 686 microswitch:ms,effector:e
676 }); 687 });
677 ms = ms.connectTo( 688 ms = ms.connectTo(
678 ms.properties.screw_connector[0], 689 ms.properties.screw_connector[0],
679 hd.properties.microswitch_screw_connector[0], 690 hd.properties.microswitch_screw_connector[0],
680 false, 0); 691 false, 0);
681 var hdhd = EFFECTOR.split_hinged(hd); 692 var hdhd = EFFECTOR.split_hinged(hd);
682 var fh = EFFECTOR.fanholder(); 693 var fh = EFFECTOR.fanholder();
683 return union({ 694 return union({
684 platform: e, 695 platform: e,
685 hinged: hdhd[1], 696 hinged: hdhd[1],
686 clamp: hdhd[0], 697 clamp: hdhd[0],
687 fanholder: fh, 698 fanholder: fh,
688 alltogethernow: [e,hdhd[0],hdhd[1], columns(),hs,ms,fh] 699 alltogethernow: [e,hdhd[0],hdhd[1], columns(),hs,ms,fh]
689 }[params.part||'alltogethernow']) 700 }[params.part||'alltogethernow'])
690 var rv = union( 701 var rv = union(
691 e, 702 e,
692 hs, 703 hs,
693 columns(), 704 columns(),
694 ///hd, 705 ///hd,
695 hdhd[0], hdhd[1], 706 hdhd[0], hdhd[1],
696 ms); 707 ms);
697 return rv; 708 return rv;
698} 709}
699 710
700function getParameterDefinitions() { 711function getParameterDefinitions() {
701 return [{ 712 return [{
702 name: 'part', 713 name: 'part',
703 type: 'choice', 714 type: 'choice',
704 values: [ 715 values: [
705 'platform', 716 'platform',
706 'hinged', 717 'hinged',
707 'clamp', 718 'clamp',
708 'fanholder', 719 'fanholder',
709 'alltogethernow', 720 'alltogethernow',
710 'wip' 721 'wip'
711 ], 722 ],
712 captions: [ 723 captions: [
713 'Effector platform', 724 'Effector platform',
714 'Hinged part', 725 'Hinged part',
715 'Clamp', 726 'Clamp',
716 'Fan holder', 727 'Fan holder',
717 'All together now!', 728 'All together now!',
718 'Work in progress' 729 'Work in progress'
719 ], 730 ],
720 caption: 'Part', 731 caption: 'Part',
721 initial: 'wip' 732 initial: 'wip'
722 },{ 733 },{
723 name: 'print', 734 name: 'print',
724 type: 'checkbox', 735 type: 'checkbox',
725 caption: 'For print, no nonsense', 736 caption: 'For print, no nonsense',
726 initial: false 737 initial: false
727 }]; 738 }];
728} 739}
729 740
730/* vim:set ft=javascript ai: */ 741/* vim:set ft=javascript ai: */