author | Michael Krelin <hacker@klever.net> | 2016-01-07 20:55:38 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2016-01-07 20:55:38 (UTC) |
commit | fb43f676ec642311ebd214a21be4c960b008bcad (patch) (unidiff) | |
tree | c8fc64217c904e6dad7f96ce87a3b6ede596340e | |
parent | 40385e372ced49ce2bc4acc1eff2f058feaa9b57 (diff) | |
download | redelta-fb43f676ec642311ebd214a21be4c960b008bcad.zip redelta-fb43f676ec642311ebd214a21be4c960b008bcad.tar.gz redelta-fb43f676ec642311ebd214a21be4c960b008bcad.tar.bz2 |
column connector for the foot
-rw-r--r-- | delta.jscad | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/delta.jscad b/delta.jscad index 2e6365c..9c13528 100644 --- a/delta.jscad +++ b/delta.jscad | |||
@@ -539,191 +539,192 @@ var E2020 = { | |||
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 | ||
545 | var THREEWINDS = [0,120,240]; | 545 | var THREEWINDS = [0,120,240]; |
546 | 546 | ||
547 | function base_sides() { | 547 | function 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 | } |
560 | function base_extrusions() { | 560 | function 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 | ||
566 | function columns() { | 566 | function 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 | } |
574 | function column_extrusions() { | 574 | function 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 | ||
580 | function duet() { | 580 | function 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 | ||
607 | function foot() { | 607 | function 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.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]); |
636 | return rv.setColor(CONFIG.color.parts); | 637 | return rv.setColor(CONFIG.color.parts); |
637 | } | 638 | } |
638 | 639 | ||
639 | function refaxes(o) { | 640 | function refaxes(o) { |
640 | if(!o) o = {}; | 641 | if(!o) o = {}; |
641 | var l = o.l||20, g = o.g||0.7; | 642 | var l = o.l||20, g = o.g||0.7; |
642 | return union([ | 643 | return union([ |
643 | 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]), |
644 | 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]), |
645 | 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]) |
646 | ]); | 647 | ]); |
647 | } | 648 | } |
648 | 649 | ||
649 | function P(x) { | 650 | function P(x) { |
650 | 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); |
651 | } | 652 | } |
652 | 653 | ||
653 | var PARTS = { | 654 | var PARTS = { |
654 | wip: function(params) { | 655 | wip: function(params) { |
655 | return foot(); | 656 | return foot(); |
656 | return union(base_extrusions(),column_extrusions(),duet()); | 657 | return union(base_extrusions(),column_extrusions(),duet()); |
657 | } | 658 | } |
658 | }; | 659 | }; |
659 | 660 | ||
660 | function main(params) { | 661 | function main(params) { |
661 | var part = params.part && PARTS[params.part]; | 662 | var part = params.part && PARTS[params.part]; |
662 | if(!part) return refaxes(); | 663 | if(!part) return refaxes(); |
663 | var rv = P(part(params)); | 664 | var rv = P(part(params)); |
664 | if(!params.print) rv = rv.union(refaxes()); | 665 | if(!params.print) rv = rv.union(refaxes()); |
665 | return rv; | 666 | return rv; |
666 | } | 667 | } |
667 | 668 | ||
668 | function _main(params) { | 669 | function _main(params) { |
669 | var e = EFFECTOR.effector(); | 670 | var e = EFFECTOR.effector(); |
670 | var hs = E3DV6.heatsink(); | 671 | var hs = E3DV6.heatsink(); |
671 | hs = hs.connectTo(hs.properties.grove_connector,e.properties.grove_connector,false,0); | 672 | hs = hs.connectTo(hs.properties.grove_connector,e.properties.grove_connector,false,0); |
672 | var ms = microswitch(); | 673 | var ms = microswitch(); |
673 | var hd = EFFECTOR.hinged({ | 674 | var hd = EFFECTOR.hinged({ |
674 | microswitch:ms,effector:e | 675 | microswitch:ms,effector:e |
675 | }); | 676 | }); |
676 | ms = ms.connectTo( | 677 | ms = ms.connectTo( |
677 | ms.properties.screw_connector[0], | 678 | ms.properties.screw_connector[0], |
678 | hd.properties.microswitch_screw_connector[0], | 679 | hd.properties.microswitch_screw_connector[0], |
679 | false, 0); | 680 | false, 0); |
680 | var hdhd = EFFECTOR.split_hinged(hd); | 681 | var hdhd = EFFECTOR.split_hinged(hd); |
681 | var fh = EFFECTOR.fanholder(); | 682 | var fh = EFFECTOR.fanholder(); |
682 | return union({ | 683 | return union({ |
683 | platform: e, | 684 | platform: e, |
684 | hinged: hdhd[1], | 685 | hinged: hdhd[1], |
685 | clamp: hdhd[0], | 686 | clamp: hdhd[0], |
686 | fanholder: fh, | 687 | fanholder: fh, |
687 | alltogethernow: [e,hdhd[0],hdhd[1], columns(),hs,ms,fh] | 688 | alltogethernow: [e,hdhd[0],hdhd[1], columns(),hs,ms,fh] |
688 | }[params.part||'alltogethernow']) | 689 | }[params.part||'alltogethernow']) |
689 | var rv = union( | 690 | var rv = union( |
690 | e, | 691 | e, |
691 | hs, | 692 | hs, |
692 | columns(), | 693 | columns(), |
693 | ///hd, | 694 | ///hd, |
694 | hdhd[0], hdhd[1], | 695 | hdhd[0], hdhd[1], |
695 | ms); | 696 | ms); |
696 | return rv; | 697 | return rv; |
697 | } | 698 | } |
698 | 699 | ||
699 | function getParameterDefinitions() { | 700 | function getParameterDefinitions() { |
700 | return [{ | 701 | return [{ |
701 | name: 'part', | 702 | name: 'part', |
702 | type: 'choice', | 703 | type: 'choice', |
703 | values: [ | 704 | values: [ |
704 | 'platform', | 705 | 'platform', |
705 | 'hinged', | 706 | 'hinged', |
706 | 'clamp', | 707 | 'clamp', |
707 | 'fanholder', | 708 | 'fanholder', |
708 | 'alltogethernow', | 709 | 'alltogethernow', |
709 | 'wip' | 710 | 'wip' |
710 | ], | 711 | ], |
711 | captions: [ | 712 | captions: [ |
712 | 'Effector platform', | 713 | 'Effector platform', |
713 | 'Hinged part', | 714 | 'Hinged part', |
714 | 'Clamp', | 715 | 'Clamp', |
715 | 'Fan holder', | 716 | 'Fan holder', |
716 | 'All together now!', | 717 | 'All together now!', |
717 | 'Work in progress' | 718 | 'Work in progress' |
718 | ], | 719 | ], |
719 | caption: 'Part', | 720 | caption: 'Part', |
720 | initial: 'wip' | 721 | initial: 'wip' |
721 | },{ | 722 | },{ |
722 | name: 'print', | 723 | name: 'print', |
723 | type: 'checkbox', | 724 | type: 'checkbox', |
724 | caption: 'For print, no nonsense', | 725 | caption: 'For print, no nonsense', |
725 | initial: false | 726 | initial: false |
726 | }]; | 727 | }]; |
727 | } | 728 | } |
728 | 729 | ||
729 | /* vim:set ft=javascript ai: */ | 730 | /* vim:set ft=javascript ai: */ |