summaryrefslogtreecommitdiffabout
path: root/delta.jscad
authorMichael Krelin <hacker@klever.net>2016-03-20 14:38:37 (UTC)
committer Michael Krelin <hacker@klever.net>2016-03-20 14:38:37 (UTC)
commit00a023fb1fa3370550b2b30b6ce06aec45436a52 (patch) (unidiff)
tree51bd7b76423adc4004514b0b5d22d972ad6eda1f /delta.jscad
parent8805ba36fd9da26d3764ad83a5c8b97c30140dc0 (diff)
downloadredelta-00a023fb1fa3370550b2b30b6ce06aec45436a52.zip
redelta-00a023fb1fa3370550b2b30b6ce06aec45436a52.tar.gz
redelta-00a023fb1fa3370550b2b30b6ce06aec45436a52.tar.bz2
newer openjscad compatibility
Diffstat (limited to 'delta.jscad') (more/less context) (ignore whitespace changes)
-rw-r--r--delta.jscad1
1 files changed, 1 insertions, 0 deletions
diff --git a/delta.jscad b/delta.jscad
index e9fb773..b783913 100644
--- a/delta.jscad
+++ b/delta.jscad
@@ -661,390 +661,391 @@ function duet() {
661 661
662function foot() { 662function foot() {
663 var F = CONFIG.foot; 663 var F = CONFIG.foot;
664 var br = F.bolt.hd/2+F.margin; 664 var br = F.bolt.hd/2+F.margin;
665 var bh = F.zscalefactor*Math.sqrt(Math.pow(F.d/2,2)-Math.pow(br,2)); 665 var bh = F.zscalefactor*Math.sqrt(Math.pow(F.d/2,2)-Math.pow(br,2));
666 var th = F.h-bh; 666 var th = F.h-bh;
667 var r = 2*F.d; 667 var r = 2*F.d;
668 var rv = CSG.sphere({ // botom contorted sphere 668 var rv = CSG.sphere({ // botom contorted sphere
669 center: [0,0,0], radius: F.d/2, resolution: r 669 center: [0,0,0], radius: F.d/2, resolution: r
670 }).scale([1,1,F.zscalefactor]).translate([0,0,bh]).union(CSG.cylinder({ // top hat 670 }).scale([1,1,F.zscalefactor]).translate([0,0,bh]).union(CSG.cylinder({ // top hat
671 start: [0,0,bh], end: [0,0,F.h], radius: F.d/2, resolution: r 671 start: [0,0,bh], end: [0,0,F.h], radius: F.d/2, resolution: r
672 })).intersect(CSG.cylinder({ // cut off excess 672 })).intersect(CSG.cylinder({ // cut off excess
673 start: [0,0,0], end: [0,0,F.h], radius: F.d 673 start: [0,0,0], end: [0,0,F.h], radius: F.d
674 })).subtract([ 674 })).subtract([
675 CSG.cylinder({ // bolt hole 675 CSG.cylinder({ // bolt hole
676 start: [0,0,-1], end: [0,0,F.h+1], radius: F.bolt.d/2+PRINT.slide_tolerance 676 start: [0,0,-1], end: [0,0,F.h+1], radius: F.bolt.d/2+PRINT.slide_tolerance
677 }), CSG.cylinder({ // nut hole 677 }), CSG.cylinder({ // nut hole
678 start: [0,0,F.h-F.nut.h-PRINT.play_tolerance], 678 start: [0,0,F.h-F.nut.h-PRINT.play_tolerance],
679 end: [0,0,F.h], 679 end: [0,0,F.h],
680 radius: F.nut.d/2+PRINT.slide_tolerance, resolution: 6 680 radius: F.nut.d/2+PRINT.slide_tolerance, resolution: 6
681 }), CSG.cylinder({ // bolthead/washer hole 681 }), CSG.cylinder({ // bolthead/washer hole
682 start: [0,0,-1], end: [0,0,F.h-F.nut.h-PRINT.play_tolerance-F.shell], 682 start: [0,0,-1], end: [0,0,F.h-F.nut.h-PRINT.play_tolerance-F.shell],
683 radius: F.bolt.hd/2+PRINT.play_tolerance 683 radius: F.bolt.hd/2+PRINT.play_tolerance
684 }) 684 })
685 ]).union(CSG.cylinder({ // bridging patch 685 ]).union(CSG.cylinder({ // bridging patch
686 start: [0,0,F.h-F.nut.h-PRINT.play_tolerance-PRINT.layer_height], 686 start: [0,0,F.h-F.nut.h-PRINT.play_tolerance-PRINT.layer_height],
687 end: [0,0,F.h-F.nut.h-PRINT.play_tolerance], 687 end: [0,0,F.h-F.nut.h-PRINT.play_tolerance],
688 radius: F.nut.d/2 688 radius: F.nut.d/2
689 })); 689 }));
690 rv.properties.c_column = new CSG.Connector([0,0,F.h],[0,0,1],[1,0,0]); 690 rv.properties.c_column = new CSG.Connector([0,0,F.h],[0,0,1],[1,0,0]);
691 rv.properties.c_shoe = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); 691 rv.properties.c_shoe = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]);
692 rv.properties.P = new CSG.Connector([0,0,F.h],[0,0,-1],[1,0,0]); 692 rv.properties.P = new CSG.Connector([0,0,F.h],[0,0,-1],[1,0,0]);
693 return rv.setColor(CONFIG.color.parts); 693 return rv.setColor(CONFIG.color.parts);
694} 694}
695function shoe() { 695function shoe() {
696 var F = CONFIG.foot; 696 var F = CONFIG.foot;
697 var rv = CSG.cylinder({ 697 var rv = CSG.cylinder({
698 start: [0,0,0], end: [0,0,F.foot.ho], 698 start: [0,0,0], end: [0,0,F.foot.ho],
699 radius: F.bolt.hd/2+F.margin 699 radius: F.bolt.hd/2+F.margin
700 }).union(CSG.cylinder({ 700 }).union(CSG.cylinder({
701 start: [0,0,0], end: [0,0,F.foot.ho+F.foot.hi], 701 start: [0,0,0], end: [0,0,F.foot.ho+F.foot.hi],
702 radius: F.bolt.hd/2+PRINT.play_tolerance-PRINT.fit_tolerance 702 radius: F.bolt.hd/2+PRINT.play_tolerance-PRINT.fit_tolerance
703 })); 703 }));
704 rv.properties.c_foot = new CSG.Connector([0,0,F.foot.ho],[0,0,1],[1,0,0]); 704 rv.properties.c_foot = new CSG.Connector([0,0,F.foot.ho],[0,0,1],[1,0,0]);
705 rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); 705 rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]);
706 return rv.setColor(CONFIG.color.softparts); 706 return rv.setColor(CONFIG.color.softparts);
707} 707}
708 708
709function duetholder() { 709function duetholder() {
710 var DH = CONFIG.duetholder; 710 var DH = CONFIG.duetholder;
711 var DHD = CD.duetholder; 711 var DHD = CD.duetholder;
712 var hw = DH.bolt.head.d+2*DH.margin; 712 var hw = DH.bolt.head.d+2*DH.margin;
713 var s = DH.bolt.l-CONFIG.extrusion.slotdepth+PRINT.play_tolerance*2; 713 var s = DH.bolt.l-CONFIG.extrusion.slotdepth+PRINT.play_tolerance*2;
714 var lower = CONFIG.foot.h-2*DH.s; 714 var lower = CONFIG.foot.h-2*DH.s;
715 var hl = DHD.distance-CONFIG.extrusion.w; 715 var hl = DHD.distance-CONFIG.extrusion.w;
716 var rv = union([ 716 var rv = union([
717 CSG.cube({ // vertical 717 CSG.cube({ // vertical
718 corner1: [-hw/2,s,CONFIG.extrusion.w], 718 corner1: [-hw/2,s,CONFIG.extrusion.w],
719 corner2: [hw/2,0,-lower] 719 corner2: [hw/2,0,-lower]
720 }), 720 }),
721 CSG.cube({ // horizontal extrusion 721 CSG.cube({ // horizontal extrusion
722 corner1: [-hw/2,-CONFIG.extrusion.w,0], 722 corner1: [-hw/2,-CONFIG.extrusion.w,0],
723 corner2: [ hw/2,0,-s] 723 corner2: [ hw/2,0,-s]
724 }), 724 }),
725 CSG.cube({ // horizontal 725 CSG.cube({ // horizontal
726 corner1: [-hw/2,0,-lower], 726 corner1: [-hw/2,0,-lower],
727 corner2: [hw/2,hl,-lower+DH.s] 727 corner2: [hw/2,hl,-lower+DH.s]
728 }), 728 }),
729 CSG.cylinder({ // boltend of horizontal part 729 CSG.cylinder({ // boltend of horizontal part
730 start: [0,hl,-lower], end: [0,hl,-lower+DH.s], 730 start: [0,hl,-lower], end: [0,hl,-lower+DH.s],
731 radius: hw/2 731 radius: hw/2
732 }) 732 })
733 ]); 733 ]);
734 rv = rv.subtract([ 734 rv = rv.subtract([
735 CSG.cylinder({ // through vertical 735 CSG.cylinder({ // through vertical
736 start: [0,-1,CONFIG.extrusion.w/2], end: [0,s+1,CONFIG.extrusion.w/2], 736 start: [0,-1,CONFIG.extrusion.w/2], end: [0,s+1,CONFIG.extrusion.w/2],
737 radius: DH.bolt.d/2+PRINT.slide_tolerance 737 radius: DH.bolt.d/2+PRINT.slide_tolerance
738 }), 738 }),
739 CSG.cylinder({ // through horizontal to extrusion 739 CSG.cylinder({ // through horizontal to extrusion
740 start: [0,-CONFIG.extrusion.w/2,-s-1], 740 start: [0,-CONFIG.extrusion.w/2,-s-1],
741 end: [0,-CONFIG.extrusion.w/2,1], 741 end: [0,-CONFIG.extrusion.w/2,1],
742 radius: DH.bolt.d/2+PRINT.slide_tolerance 742 radius: DH.bolt.d/2+PRINT.slide_tolerance
743 }), 743 }),
744 CSG.cube({ // cut off 744 CSG.cube({ // cut off
745 corner1: [-hw/2-1,-2*s,0], 745 corner1: [-hw/2-1,-2*s,0],
746 corner2: [hw/2+1,0,-2*s] 746 corner2: [hw/2+1,0,-2*s]
747 }).rotateX(45).translate([0,-CONFIG.extrusion.w,0]), 747 }).rotateX(45).translate([0,-CONFIG.extrusion.w,0]),
748 CSG.cylinder({ // duet bolt 748 CSG.cylinder({ // duet bolt
749 start: [0,hl,-lower], end: [0,hl,-lower+DH.s], 749 start: [0,hl,-lower], end: [0,hl,-lower+DH.s],
750 radius: DH.bolt.d/2+PRINT.slide_tolerance 750 radius: DH.bolt.d/2+PRINT.slide_tolerance
751 }) 751 })
752 ]); 752 ]);
753 var cp = [0,hl,-lower+DH.s]; 753 var cp = [0,hl,-lower+DH.s];
754 rv.properties.duet = new CSG.Properties(); 754 rv.properties.duet = new CSG.Properties();
755 rv.properties.duet.c_sw = new CSG.Connector(cp,[0,0,1],[1,0,0]); 755 rv.properties.duet.c_sw = new CSG.Connector(cp,[0,0,1],[1,0,0]);
756 rv.properties.duet.c_se = new CSG.Connector(cp,[0,0,1],[1,0,0]); 756 rv.properties.duet.c_se = new CSG.Connector(cp,[0,0,1],[1,0,0]);
757 rv.properties.duet.c_ne = new CSG.Connector(cp,[0,0,1],[-Math.cos(Math.PI/3),-Math.sin(Math.PI/3),0]); 757 rv.properties.duet.c_ne = new CSG.Connector(cp,[0,0,1],[-Math.cos(Math.PI/3),-Math.sin(Math.PI/3),0]);
758 rv.properties.duet.c_nw = new CSG.Connector(cp,[0,0,1],[-Math.cos(Math.PI/3),Math.sin(Math.PI/3),0]); 758 rv.properties.duet.c_nw = new CSG.Connector(cp,[0,0,1],[-Math.cos(Math.PI/3),Math.sin(Math.PI/3),0]);
759 rv.properties.c_h = new CSG.Connector([0,-CONFIG.extrusion.w/2,0],[0,0,1],[1,0,0]); 759 rv.properties.c_h = new CSG.Connector([0,-CONFIG.extrusion.w/2,0],[0,0,1],[1,0,0]);
760 rv.properties.c_v = new CSG.Connector([0,0,CONFIG.extrusion.w/2],[0,-1,0],[0,0,1]); 760 rv.properties.c_v = new CSG.Connector([0,0,CONFIG.extrusion.w/2],[0,-1,0],[0,0,1]);
761 rv.properties.P = new CSG.Connector([-hw/2,0,0],[1,0,0],[0,1,0]); 761 rv.properties.P = new CSG.Connector([-hw/2,0,0],[1,0,0],[0,1,0]);
762 return rv.setColor(CONFIG.color.parts); 762 return rv.setColor(CONFIG.color.parts);
763} 763}
764 764
765function heatbed() { 765function heatbed() {
766 var rv = CSG.cylinder({ 766 var rv = CSG.cylinder({
767 start: [0,0,0], end: [0,0,CONFIG.heatbed.h], 767 start: [0,0,0], end: [0,0,CONFIG.heatbed.h],
768 radius: CONFIG.heatbed.r, resolution: 72 768 radius: CONFIG.heatbed.r, resolution: 72
769 }); 769 });
770 var screw = CSG.cylinder({ 770 var screw = CSG.cylinder({
771 start: [0,-CONFIG.heatbed.sr,-1], 771 start: [0,-CONFIG.heatbed.sr,-1],
772 end: [0,-CONFIG.heatbed.sr,CONFIG.heatbed.h+1], 772 end: [0,-CONFIG.heatbed.sr,CONFIG.heatbed.h+1],
773 radius: 3/2 773 radius: 3/2
774 }); 774 });
775 var screws = []; 775 var screws = [];
776 for(var a=0;a<360;a+=60) screws.push(screw.rotateZ(a)); // TODO: connectors 776 for(var a=0;a<360;a+=60) screws.push(screw.rotateZ(a)); // TODO: connectors
777 rv = rv.subtract(screws); 777 rv = rv.subtract(screws);
778 rv.properties.c_glass = new CSG.Connector([0,0,CONFIG.heatbed.h],[0,0,1],[1,0,0]); 778 rv.properties.c_glass = new CSG.Connector([0,0,CONFIG.heatbed.h],[0,0,1],[1,0,0]);
779 rv.properties.P = new CSG.Connector( 779 rv.properties.P = new CSG.Connector(
780 [0,0,-CONFIG.foot.h-CONFIG.extrusion.w*2-CONFIG.base.gap-CONFIG.bedholder.h], 780 [0,0,-CONFIG.foot.h-CONFIG.extrusion.w*2-CONFIG.base.gap-CONFIG.bedholder.h],
781 [0,0,1],[1,0,0]); 781 [0,0,1],[1,0,0]);
782 rv.properties.vitamin = true; 782 rv.properties.vitamin = true;
783 return rv.setColor(CONFIG.color.heatbed); 783 return rv.setColor(CONFIG.color.heatbed);
784} 784}
785function glass() { 785function glass() {
786 var rv = CSG.cylinder({ 786 var rv = CSG.cylinder({
787 start: [0,0,0], end: [0,0,CONFIG.glass.h], 787 start: [0,0,0], end: [0,0,CONFIG.glass.h],
788 radius: CONFIG.glass.r, resolution: 72 788 radius: CONFIG.glass.r, resolution: 72
789 }); 789 });
790 rv.properties.c_bed = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); 790 rv.properties.c_bed = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]);
791 rv.properties.P = new CSG.Connector([0,0,-CONFIG.foot.h-CONFIG.heatbed.h],[0,0,1],[1,0,0]); 791 rv.properties.P = new CSG.Connector([0,0,-CONFIG.foot.h-CONFIG.heatbed.h],[0,0,1],[1,0,0]);
792 rv.properties.vitamin = true; 792 rv.properties.vitamin = true;
793 return rv.setColor(CONFIG.color.glass); 793 return rv.setColor(CONFIG.color.glass);
794} 794}
795function platform() { 795function platform() {
796 var b = heatbed(); 796 var b = heatbed();
797 var g = glass(); 797 var g = glass();
798 g = g.connectTo(g.properties.c_bed,b.properties.c_glass,false,0); 798 g = g.connectTo(g.properties.c_bed,b.properties.c_glass,false,0);
799 return b.union(g); 799 return b.union(g);
800} 800}
801 801
802function bedholder(params) { 802function bedholder(params) {
803 var h0 = CONFIG.foot.h+CONFIG.extrusion.w*2+CONFIG.base.gap; 803 var h0 = CONFIG.foot.h+CONFIG.extrusion.w*2+CONFIG.base.gap;
804 var e_h=E2020.T.thickness; // height of the bump for extrusion 804 var e_h=E2020.T.thickness; // height of the bump for extrusion
805 var e_w=E2020.slot_width-PRINT.fit_tolerance; // width of the bump for extrusion 805 var e_w=E2020.slot_width-PRINT.fit_tolerance; // width of the bump for extrusion
806 var e_o=E2020.slot_width+PRINT.fit_tolerance; // opening for the T-Nut width 806 var e_o=E2020.slot_width+PRINT.fit_tolerance; // opening for the T-Nut width
807 var rv = CSG.cylinder({ 807 var rv = CSG.cylinder({
808 start: [0,0,h0], end: [0,0,h0+CONFIG.bedholder.h], 808 start: [0,0,h0], end: [0,0,h0+CONFIG.bedholder.h],
809 radiusStart: CD.base.outer_inscription_r, 809 radiusStart: CD.base.outer_inscription_r,
810 radiusEnd: CD.base.outer_inscription_r+CONFIG.bedholder.h/2, 810 radiusEnd: CD.base.outer_inscription_r+CONFIG.bedholder.h/2,
811 resolution: 240 811 resolution: 240
812 }); 812 });
813 rv=rv.intersect(CSG.cube({ 813 rv=rv.intersect(CSG.cube({
814 corner1: [-CONFIG.extrusion.w/2,-CD.base.inner_inscription_r,h0], 814 corner1: [-CONFIG.extrusion.w/2,-CD.base.inner_inscription_r,h0],
815 corner2: [ CONFIG.extrusion.w/2,-CD.base.mid_inscription_r*2,h0+2*CONFIG.bedholder.h] 815 corner2: [ CONFIG.extrusion.w/2,-CD.base.mid_inscription_r*2,h0+2*CONFIG.bedholder.h]
816 })); 816 }));
817 817
818 rv=rv.union(CSG.cube({ // bump to fix on extrusion 818 rv=rv.union(CSG.cube({ // bump to fix on extrusion
819 corner1: [-CONFIG.extrusion.w/2,-CD.base.mid_inscription_r-e_w/2,h0], 819 corner1: [-CONFIG.extrusion.w/2,-CD.base.mid_inscription_r-e_w/2,h0],
820 corner2: [ CONFIG.extrusion.w/2,-CD.base.mid_inscription_r+e_w/2,h0-e_h] 820 corner2: [ CONFIG.extrusion.w/2,-CD.base.mid_inscription_r+e_w/2,h0-e_h]
821 }).subtract( 821 }).subtract(
822 CSG.cube({center:[0,0,0],radius:[(e_o+2*e_h)/(2*Math.sqrt(2)),e_w+2,(e_o+2*e_h)/(2*Math.sqrt(2))]}) 822 CSG.cube({center:[0,0,0],radius:[(e_o+2*e_h)/(2*Math.sqrt(2)),e_w+2,(e_o+2*e_h)/(2*Math.sqrt(2))]})
823 .rotateY(45) 823 .rotateY(45)
824 .translate([0,-CD.base.mid_inscription_r,h0-e_h]) 824 .translate([0,-CD.base.mid_inscription_r,h0-e_h])
825 )); 825 ));
826 826
827 var ebolt_s = CONFIG.bedholder.bolt.l-CONFIG.extrusion.slotdepth+PRINT.play_tolerance*2; 827 var ebolt_s = CONFIG.bedholder.bolt.l-CONFIG.extrusion.slotdepth+PRINT.play_tolerance*2;
828 rv=rv.subtract([ 828 rv=rv.subtract([
829 CSG.cylinder({ // base screw 829 CSG.cylinder({ // base screw
830 start: [0,-CD.base.mid_inscription_r,h0-1], 830 start: [0,-CD.base.mid_inscription_r,h0-1],
831 end: [0,-CD.base.mid_inscription_r,h0+CONFIG.bedholder.h+1], 831 end: [0,-CD.base.mid_inscription_r,h0+CONFIG.bedholder.h+1],
832 radius: CONFIG.bedholder.bolt.d/2+PRINT.screw_tolerance/2 832 radius: CONFIG.bedholder.bolt.d/2+PRINT.screw_tolerance/2
833 }), 833 }),
834 CSG.cylinder({ // base screw head 834 CSG.cylinder({ // base screw head
835 start: [0,-CD.base.mid_inscription_r,h0+ebolt_s], 835 start: [0,-CD.base.mid_inscription_r,h0+ebolt_s],
836 end: [0,-CD.base.mid_inscription_r,h0+CONFIG.bedholder.h+1], 836 end: [0,-CD.base.mid_inscription_r,h0+CONFIG.bedholder.h+1],
837 radius: CONFIG.bedholder.bolt.head.d/2+PRINT.play_tolerance 837 radius: CONFIG.bedholder.bolt.head.d/2+PRINT.play_tolerance
838 }) 838 })
839 ]); 839 ]);
840 840
841 var nuth=h0+CONFIG.bedholder.h*3/4; 841 var nuth=h0+CONFIG.bedholder.h*3/4;
842 rv=rv.subtract([ 842 rv=rv.subtract([
843 CSG.cylinder({ // bed screw 843 CSG.cylinder({ // bed screw
844 start: [0,-CONFIG.heatbed.sr,h0-1], 844 start: [0,-CONFIG.heatbed.sr,h0-1],
845 end: [0,-CONFIG.heatbed.sr,h0+CONFIG.bedholder.h+1], 845 end: [0,-CONFIG.heatbed.sr,h0+CONFIG.bedholder.h+1],
846 radius: CONFIG.bedholder.bolt.d/2+PRINT.screw_tolerance/2 846 radius: CONFIG.bedholder.bolt.d/2+PRINT.screw_tolerance/2
847 }), 847 }),
848 CSG.cube({ // nut pocket 848 CSG.cube({ // nut pocket
849 center: [0,-CONFIG.heatbed.sr,nuth], 849 center: [0,-CONFIG.heatbed.sr,nuth],
850 radius: [CONFIG.extrusion.w/2+1,CONFIG.bedholder.nut.w/2+PRINT.slide_tolerance/2,CONFIG.bedholder.nut.h/2+PRINT.slide_tolerance/2] 850 radius: [CONFIG.extrusion.w/2+1,CONFIG.bedholder.nut.w/2+PRINT.slide_tolerance/2,CONFIG.bedholder.nut.h/2+PRINT.slide_tolerance/2]
851 }) 851 })
852 ]); 852 ]);
853 853
854 rv.properties.P = new CSG.Connector([-CONFIG.extrusion.w/2,-CD.base.mid_inscription_r,h0+CONFIG.bedholder.h/2], 854 rv.properties.P = new CSG.Connector([-CONFIG.extrusion.w/2,-CD.base.mid_inscription_r,h0+CONFIG.bedholder.h/2],
855 [1,0,0],[0,0,1]); 855 [1,0,0],[0,0,1]);
856 return rv.setColor(CONFIG.color.parts); 856 return rv.setColor(CONFIG.color.parts);
857 var bolt_s = CONFIG.bedholder.bolt.l-CONFIG.extrusion.slotdepth+PRINT.play_tolerance*2; 857 var bolt_s = CONFIG.bedholder.bolt.l-CONFIG.extrusion.slotdepth+PRINT.play_tolerance*2;
858 var nuth=h0+CONFIG.bedholder.h*3/4; 858 var nuth=h0+CONFIG.bedholder.h*3/4;
859 var nutth = nuth+CONFIG.bedholder.nut.h/2+PRINT.slide_tolerance/2; 859 var nutth = nuth+CONFIG.bedholder.nut.h/2+PRINT.slide_tolerance/2;
860 var rv = CSG.roundedCube({ 860 var rv = CSG.roundedCube({
861 corner1: [-CONFIG.extrusion.w/2,-CD.base.inner_inscription_r,h0], 861 corner1: [-CONFIG.extrusion.w/2,-CD.base.inner_inscription_r,h0],
862 corner2: [ CONFIG.extrusion.w/2,-CONFIG.heatbed.sr-3/2-CONFIG.bedholder.margin,h0+CONFIG.bedholder.h], 862 corner2: [ CONFIG.extrusion.w/2,-CONFIG.heatbed.sr-3/2-CONFIG.bedholder.margin,h0+CONFIG.bedholder.h],
863 roundradius: CONFIG.bedholder.margin 863 roundradius: CONFIG.bedholder.margin
864 }); 864 });
865 rv = rv.subtract([ 865 rv = rv.subtract([
866 CSG.cylinder({ // base screw 866 CSG.cylinder({ // base screw
867 start: [0,-CD.base.mid_inscription_r,h0-1], 867 start: [0,-CD.base.mid_inscription_r,h0-1],
868 end: [0,-CD.base.mid_inscription_r,h0+CONFIG.bedholder.h+1], 868 end: [0,-CD.base.mid_inscription_r,h0+CONFIG.bedholder.h+1],
869 radius: CONFIG.bedholder.bolt.d/2+PRINT.screw_tolerance/2 869 radius: CONFIG.bedholder.bolt.d/2+PRINT.screw_tolerance/2
870 }), 870 }),
871 CSG.cylinder({ // bed screw 871 CSG.cylinder({ // bed screw
872 start: [0,-CONFIG.heatbed.sr,h0-1], 872 start: [0,-CONFIG.heatbed.sr,h0-1],
873 end: [0,-CONFIG.heatbed.sr,h0+CONFIG.bedholder.h+1], 873 end: [0,-CONFIG.heatbed.sr,h0+CONFIG.bedholder.h+1],
874 radius: CONFIG.bedholder.bolt.d/2+PRINT.screw_tolerance/2 874 radius: CONFIG.bedholder.bolt.d/2+PRINT.screw_tolerance/2
875 }), 875 }),
876 CSG.cube({ // nut pocket 876 CSG.cube({ // nut pocket
877 center: [0,-CONFIG.heatbed.sr,nuth], 877 center: [0,-CONFIG.heatbed.sr,nuth],
878 radius: [CONFIG.extrusion.w/2+1,(CONFIG.bedholder.nut.w+PRINT.slide_tolerance)/2,(CONFIG.bedholder.nut.h+PRINT.slide_tolerance)/2] 878 radius: [CONFIG.extrusion.w/2+1,(CONFIG.bedholder.nut.w+PRINT.slide_tolerance)/2,(CONFIG.bedholder.nut.h+PRINT.slide_tolerance)/2]
879 }), 879 }),
880 CSG.cylinder({ // sink base screw 880 CSG.cylinder({ // sink base screw
881 start: [0,-CD.base.mid_inscription_r,h0+bolt_s], 881 start: [0,-CD.base.mid_inscription_r,h0+bolt_s],
882 end: [0,-CD.base.mid_inscription_r,h0+CONFIG.bedholder.h+1], 882 end: [0,-CD.base.mid_inscription_r,h0+CONFIG.bedholder.h+1],
883 radius: CONFIG.bedholder.bolt.head.d/2+PRINT.play_tolerance 883 radius: CONFIG.bedholder.bolt.head.d/2+PRINT.play_tolerance
884 }) 884 })
885 ]); 885 ]);
886 rv = rv.union(CSG.cylinder({ // patch up for bridging 886 rv = rv.union(CSG.cylinder({ // patch up for bridging
887 start: [0,-CONFIG.heatbed.sr,nutth], end: [0,-CONFIG.heatbed.sr,nutth+PRINT.layer_height], 887 start: [0,-CONFIG.heatbed.sr,nutth], end: [0,-CONFIG.heatbed.sr,nutth+PRINT.layer_height],
888 radius: (CONFIG.bedholder.nut.w+PRINT.slide_tolerance)/2+PRINT.extrusion_width 888 radius: (CONFIG.bedholder.nut.w+PRINT.slide_tolerance)/2+PRINT.extrusion_width
889 })); 889 }));
890 rv = rv.intersect(CSG.cylinder({ // cut off excess 890 rv = rv.intersect(CSG.cylinder({ // cut off excess
891 start: [0,0,h0-1], end: [0,0,h0+CONFIG.bedholder.h+1], 891 start: [0,0,h0-1], end: [0,0,h0+CONFIG.bedholder.h+1],
892 radius: CONFIG.heatbed.r, resolution: 270 892 radius: CONFIG.heatbed.r, resolution: 270
893 })); 893 }));
894 rv.properties.P = new CSG.Connector([0,-CD.base.mid_inscription_r,h0],[0,0,1],[1,0,0]); 894 rv.properties.P = new CSG.Connector([0,-CD.base.mid_inscription_r,h0],[0,0,1],[1,0,0]);
895 return rv.setColor(CONFIG.color.parts); 895 return rv.setColor(CONFIG.color.parts);
896} 896}
897 897
898var PARTS = { 898var PARTS = {
899 wip: function(params) { 899 wip: function(params) {
900 return duetholder(params); 900 return duetholder(params);
901 return PARTS.alltogethernow(params); 901 return PARTS.alltogethernow(params);
902 return base_extrusions(); 902 return base_extrusions();
903 return foot(); 903 return foot();
904 return union(base_extrusions(),column_extrusions(),duet().translate([0,-20,0])); 904 return union(base_extrusions(),column_extrusions(),duet().translate([0,-20,0]));
905 }, 905 },
906 alltogethernow: function(params) { 906 alltogethernow: function(params) {
907 var cols = columns(); 907 var cols = columns();
908 var sides = base_sides(); 908 var sides = base_sides();
909 var feet = THREEWINDS.map(function(w,i) { 909 var feet = THREEWINDS.map(function(w,i) {
910 var rv = foot(); 910 var rv = foot();
911 rv = rv.connectTo(rv.properties.c_column,cols[i].properties.c_bottom,false,0); 911 rv = rv.connectTo(rv.properties.c_column,cols[i].properties.c_bottom,false,0);
912 var s = shoe(); 912 var s = shoe();
913 s = s.connectTo(s.properties.c_foot,rv.properties.c_shoe,false,0); 913 s = s.connectTo(s.properties.c_foot,rv.properties.c_shoe,false,0);
914 return rv.union(s); 914 return rv.union(s);
915 }); 915 });
916 var dh = duetholder(); 916 var dh = duetholder();
917 var dhsw = dh.connectTo(dh.properties.c_h, 917 var dhsw = dh.connectTo(dh.properties.c_h,
918 new CSG.Connector([-CONFIG.duet.hole_spacing.x/2,-CD.base.mid_inscription_r,CONFIG.foot.h],[0,0,1],[1,0,0]), 918 new CSG.Connector([-CONFIG.duet.hole_spacing.x/2,-CD.base.mid_inscription_r,CONFIG.foot.h],[0,0,1],[1,0,0]),
919 false,0); 919 false,0);
920 var d = duet(); 920 var d = duet();
921 d = d.connectTo(d.properties.holes.c_sw,dhsw.properties.duet.c_sw,false,0); 921 d = d.connectTo(d.properties.holes.c_sw,dhsw.properties.duet.c_sw,false,0);
922 var dhse = dh.connectTo(dh.properties.duet.c_se,d.properties.holes.c_se,false,0); 922 var dhse = dh.connectTo(dh.properties.duet.c_se,d.properties.holes.c_se,false,0);
923 var dhne = dh.connectTo(dh.properties.duet.c_ne,d.properties.holes.c_ne,false,0); 923 var dhne = dh.connectTo(dh.properties.duet.c_ne,d.properties.holes.c_ne,false,0);
924 var dhnw = dh.connectTo(dh.properties.duet.c_nw,d.properties.holes.c_nw,false,0); 924 var dhnw = dh.connectTo(dh.properties.duet.c_nw,d.properties.holes.c_nw,false,0);
925 var rv = union(cols).union(sides.map(union)).union(feet).union([ 925 var rv = union(cols).union(sides.map(union)).union(feet).union([
926 d,dhsw,dhse,dhne,dhnw 926 d,dhsw,dhse,dhne,dhnw
927 ]); 927 ]);
928 var p = U.P(platform()); 928 var p = U.P(platform());
929 rv = rv.union(p); 929 rv = rv.union(p);
930 rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); 930 rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]);
931 return rv; 931 return rv;
932 }, 932 },
933 duetholder: function(params) { 933 duetholder: function(params) {
934 return duetholder(); 934 return duetholder();
935 }, 935 },
936 foot: foot, 936 foot: foot,
937 shoe: shoe, 937 shoe: shoe,
938 bedholder: bedholder, 938 bedholder: bedholder,
939 platform: function(params) { return U.P(EFFECTOR.effector()) }, 939 platform: function(params) { return U.P(EFFECTOR.effector()) },
940 hinged: function(params) { 940 hinged: function(params) {
941 // TODO: handle print mode 941 // TODO: handle print mode
942 var ms = microswitch(); 942 var ms = microswitch();
943 var e = EFFECTOR.effector(); 943 var e = EFFECTOR.effector();
944 var hd = EFFECTOR.hinged({ 944 var hd = EFFECTOR.hinged({
945 microswitch:ms,effector:e 945 microswitch:ms,effector:e
946 }); 946 });
947 ms = ms.connectTo( 947 ms = ms.connectTo(
948 ms.properties.screw_connector[0], 948 ms.properties.screw_connector[0],
949 hd.properties.microswitch_screw_connector[0], 949 hd.properties.microswitch_screw_connector[0],
950 false, 0); 950 false, 0);
951 var hdhd = EFFECTOR.split_hinged(hd); 951 var hdhd = EFFECTOR.split_hinged(hd);
952 return U.P(hdhd[1]); 952 return U.P(hdhd[1]);
953 }, 953 },
954 // TODO: eliminate common code above and below 954 // TODO: eliminate common code above and below
955 clamp: function(params) { 955 clamp: function(params) {
956 // TODO: handle print mode 956 // TODO: handle print mode
957 var ms = microswitch(); 957 var ms = microswitch();
958 var e = EFFECTOR.effector(); 958 var e = EFFECTOR.effector();
959 var hd = EFFECTOR.hinged({ 959 var hd = EFFECTOR.hinged({
960 microswitch:ms,effector:e 960 microswitch:ms,effector:e
961 }); 961 });
962 ms = ms.connectTo( 962 ms = ms.connectTo(
963 ms.properties.screw_connector[0], 963 ms.properties.screw_connector[0],
964 hd.properties.microswitch_screw_connector[0], 964 hd.properties.microswitch_screw_connector[0],
965 false, 0); 965 false, 0);
966 var hdhd = EFFECTOR.split_hinged(hd); 966 var hdhd = EFFECTOR.split_hinged(hd);
967 return U.P(hdhd[0]); 967 return U.P(hdhd[0]);
968 }, 968 },
969 fanholder: function(params) { 969 fanholder: function(params) {
970 EFFECTOR.effector(); // to set up rmount 970 EFFECTOR.effector(); // to set up rmount
971 return U.P(EFFECTOR.fanholder()); 971 return U.P(EFFECTOR.fanholder());
972 } 972 }
973}; 973};
974 974
975function main(params) { 975function main(params) {
976 var part = params.part && PARTS[params.part]; 976 var part = params.part && PARTS[params.part];
977 if(!part) return U.axes(); 977 if(!part) return U.axes();
978 var rv = U.P(part(params)); 978 var rv = U.P(part(params));
979 if(!params.print) rv = rv.union(U.axes()); 979 if(!params.print) rv = rv.union(U.axes());
980 return rv; 980 return rv;
981} 981}
982 982
983function _main(params) { 983function _main(params) {
984 var e = EFFECTOR.effector(); 984 var e = EFFECTOR.effector();
985 var hs = E3DV6.heatsink(); 985 var hs = E3DV6.heatsink();
986 hs = hs.connectTo(hs.properties.grove_connector,e.properties.grove_connector,false,0); 986 hs = hs.connectTo(hs.properties.grove_connector,e.properties.grove_connector,false,0);
987 var ms = microswitch(); 987 var ms = microswitch();
988 var hd = EFFECTOR.hinged({ 988 var hd = EFFECTOR.hinged({
989 microswitch:ms,effector:e 989 microswitch:ms,effector:e
990 }); 990 });
991 ms = ms.connectTo( 991 ms = ms.connectTo(
992 ms.properties.screw_connector[0], 992 ms.properties.screw_connector[0],
993 hd.properties.microswitch_screw_connector[0], 993 hd.properties.microswitch_screw_connector[0],
994 false, 0); 994 false, 0);
995 var hdhd = EFFECTOR.split_hinged(hd); 995 var hdhd = EFFECTOR.split_hinged(hd);
996 var fh = EFFECTOR.fanholder(); 996 var fh = EFFECTOR.fanholder();
997 return union({ 997 return union({
998 platform: e, 998 platform: e,
999 hinged: hdhd[1], 999 hinged: hdhd[1],
1000 clamp: hdhd[0], 1000 clamp: hdhd[0],
1001 fanholder: fh, 1001 fanholder: fh,
1002 alltogethernow: [e,hdhd[0],hdhd[1], columns(),hs,ms,fh] 1002 alltogethernow: [e,hdhd[0],hdhd[1], columns(),hs,ms,fh]
1003 }[params.part||'alltogethernow']) 1003 }[params.part||'alltogethernow'])
1004 var rv = union( 1004 var rv = union(
1005 e, 1005 e,
1006 hs, 1006 hs,
1007 columns(), 1007 columns(),
1008 ///hd, 1008 ///hd,
1009 hdhd[0], hdhd[1], 1009 hdhd[0], hdhd[1],
1010 ms); 1010 ms);
1011 return rv; 1011 return rv;
1012} 1012}
1013 1013
1014function getParameterDefinitions() { 1014function getParameterDefinitions() {
1015 return [{ 1015 return [{
1016 name: 'part', 1016 name: 'part',
1017 type: 'choice', 1017 type: 'choice',
1018 values: [ 1018 values: [
1019 'platform', 1019 'platform',
1020 'hinged', 1020 'hinged',
1021 'clamp', 1021 'clamp',
1022 'fanholder', 1022 'fanholder',
1023 'duetholder', 1023 'duetholder',
1024 'foot', 'shoe', 1024 'foot', 'shoe',
1025 'bedholder', 1025 'bedholder',
1026 'alltogethernow', 1026 'alltogethernow',
1027 'wip' 1027 'wip'
1028 ], 1028 ],
1029 captions: [ 1029 captions: [
1030 'Effector platform', 1030 'Effector platform',
1031 'Hinged part', 1031 'Hinged part',
1032 'Clamp', 1032 'Clamp',
1033 'Fan holder', 1033 'Fan holder',
1034 'Duet holder', 1034 'Duet holder',
1035 'Foot', 'Shoe', 1035 'Foot', 'Shoe',
1036 'Bed holder', 1036 'Bed holder',
1037 'All together now!', 1037 'All together now!',
1038 'Work in progress' 1038 'Work in progress'
1039 ], 1039 ],
1040 caption: 'Part', 1040 caption: 'Part',
1041 initial: 'wip' 1041 initial: 'wip'
1042 },{ 1042 },{
1043 name: 'print', 1043 name: 'print',
1044 type: 'checkbox', 1044 type: 'checkbox',
1045 checked: false,
1045 caption: 'For print, no nonsense', 1046 caption: 'For print, no nonsense',
1046 initial: false 1047 initial: false
1047 }]; 1048 }];
1048} 1049}
1049 1050
1050/* vim:set ft=javascript ai: */ 1051/* vim:set ft=javascript ai: */