summaryrefslogtreecommitdiffabout
path: root/delta.jscad
authorMichael Krelin <hacker@klever.net>2016-01-13 10:13:41 (UTC)
committer Michael Krelin <hacker@klever.net>2016-01-13 10:13:41 (UTC)
commit34af0c1f06a2bec183afdc412d4a05c1d0c8906f (patch) (unidiff)
treeb21814323d66619ec131546ac95ecf81a33876d2 /delta.jscad
parentf8b3bc2a1792a7ee8eeacf7dd1d9f5b3cc96a7a6 (diff)
downloadredelta-34af0c1f06a2bec183afdc412d4a05c1d0c8906f.zip
redelta-34af0c1f06a2bec183afdc412d4a05c1d0c8906f.tar.gz
redelta-34af0c1f06a2bec183afdc412d4a05c1d0c8906f.tar.bz2
moving things around
Diffstat (limited to 'delta.jscad') (more/less context) (ignore whitespace changes)
-rw-r--r--delta.jscad29
1 files changed, 15 insertions, 14 deletions
diff --git a/delta.jscad b/delta.jscad
index 7384ecf..156e704 100644
--- a/delta.jscad
+++ b/delta.jscad
@@ -719,179 +719,180 @@ function duetholder() {
719 rv.properties.duet = new CSG.Properties(); 719 rv.properties.duet = new CSG.Properties();
720 rv.properties.duet.c_sw = new CSG.Connector(cp,[0,0,1],[1,0,0]); 720 rv.properties.duet.c_sw = new CSG.Connector(cp,[0,0,1],[1,0,0]);
721 rv.properties.duet.c_se = new CSG.Connector(cp,[0,0,1],[1,0,0]); 721 rv.properties.duet.c_se = new CSG.Connector(cp,[0,0,1],[1,0,0]);
722 rv.properties.duet.c_ne = new CSG.Connector(cp,[0,0,1],[-Math.cos(Math.PI/3),-Math.sin(Math.PI/3),0]); 722 rv.properties.duet.c_ne = new CSG.Connector(cp,[0,0,1],[-Math.cos(Math.PI/3),-Math.sin(Math.PI/3),0]);
723 rv.properties.duet.c_nw = new CSG.Connector(cp,[0,0,1],[-Math.cos(Math.PI/3),Math.sin(Math.PI/3),0]); 723 rv.properties.duet.c_nw = new CSG.Connector(cp,[0,0,1],[-Math.cos(Math.PI/3),Math.sin(Math.PI/3),0]);
724 rv.properties.c_h = new CSG.Connector([0,-CONFIG.extrusion.w/2,0],[0,0,1],[1,0,0]); 724 rv.properties.c_h = new CSG.Connector([0,-CONFIG.extrusion.w/2,0],[0,0,1],[1,0,0]);
725 rv.properties.c_v = new CSG.Connector([0,0,CONFIG.extrusion.w/2],[0,-1,0],[0,0,1]); 725 rv.properties.c_v = new CSG.Connector([0,0,CONFIG.extrusion.w/2],[0,-1,0],[0,0,1]);
726 rv.properties.P = new CSG.Connector([-hw/2,0,0],[1,0,0],[0,1,0]); 726 rv.properties.P = new CSG.Connector([-hw/2,0,0],[1,0,0],[0,1,0]);
727 return rv.setColor(CONFIG.color.parts); 727 return rv.setColor(CONFIG.color.parts);
728} 728}
729 729
730function heatbed() { 730function heatbed() {
731 var rv = CSG.cylinder({ 731 var rv = CSG.cylinder({
732 start: [0,0,0], end: [0,0,CONFIG.heatbed.h], 732 start: [0,0,0], end: [0,0,CONFIG.heatbed.h],
733 radius: CONFIG.heatbed.r, resolution: 72 733 radius: CONFIG.heatbed.r, resolution: 72
734 }); 734 });
735 var screw = CSG.cylinder({ 735 var screw = CSG.cylinder({
736 start: [0,-CONFIG.heatbed.sr,-1], 736 start: [0,-CONFIG.heatbed.sr,-1],
737 end: [0,-CONFIG.heatbed.sr,CONFIG.heatbed.h+1], 737 end: [0,-CONFIG.heatbed.sr,CONFIG.heatbed.h+1],
738 radius: 3/2 738 radius: 3/2
739 }); 739 });
740 var screws = []; 740 var screws = [];
741 for(var a=0;a<360;a+=60) screws.push(screw.rotateZ(a)); // TODO: connectors 741 for(var a=0;a<360;a+=60) screws.push(screw.rotateZ(a)); // TODO: connectors
742 rv = rv.subtract(screws); 742 rv = rv.subtract(screws);
743 rv.properties.c_glass = new CSG.Connector([0,0,CONFIG.heatbed.h],[0,0,1],[1,0,0]); 743 rv.properties.c_glass = new CSG.Connector([0,0,CONFIG.heatbed.h],[0,0,1],[1,0,0]);
744 rv.properties.P = new CSG.Connector( 744 rv.properties.P = new CSG.Connector(
745 [0,0,-CONFIG.foot.h-CONFIG.extrusion.w*2-CONFIG.base.gap-CONFIG.bedholder.h], 745 [0,0,-CONFIG.foot.h-CONFIG.extrusion.w*2-CONFIG.base.gap-CONFIG.bedholder.h],
746 [0,0,1],[1,0,0]); 746 [0,0,1],[1,0,0]);
747 rv.properties.vitamin = true; 747 rv.properties.vitamin = true;
748 return rv.setColor(CONFIG.color.heatbed); 748 return rv.setColor(CONFIG.color.heatbed);
749} 749}
750function glass() { 750function glass() {
751 var rv = CSG.cylinder({ 751 var rv = CSG.cylinder({
752 start: [0,0,0], end: [0,0,CONFIG.glass.h], 752 start: [0,0,0], end: [0,0,CONFIG.glass.h],
753 radius: CONFIG.glass.r, resolution: 72 753 radius: CONFIG.glass.r, resolution: 72
754 }); 754 });
755 rv.properties.c_bed = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); 755 rv.properties.c_bed = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]);
756 rv.properties.P = new CSG.Connector([0,0,-CONFIG.foot.h-CONFIG.heatbed.h],[0,0,1],[1,0,0]); 756 rv.properties.P = new CSG.Connector([0,0,-CONFIG.foot.h-CONFIG.heatbed.h],[0,0,1],[1,0,0]);
757 rv.properties.vitamin = true; 757 rv.properties.vitamin = true;
758 return rv.setColor(CONFIG.color.glass); 758 return rv.setColor(CONFIG.color.glass);
759} 759}
760function platform() { 760function platform() {
761 var b = heatbed(); 761 var b = heatbed();
762 var g = glass(); 762 var g = glass();
763 g = g.connectTo(g.properties.c_bed,b.properties.c_glass,false,0); 763 g = g.connectTo(g.properties.c_bed,b.properties.c_glass,false,0);
764 return b.union(g); 764 return b.union(g);
765} 765}
766 766
767function refaxes(o) {
768 if(!o) o = {};
769 var l = o.l||20, g = o.g||0.7;
770 return union([
771 CSG.roundedCylinder({start:[0,0,0],end:[l,0,0]}).setColor([1,0,0,g]),
772 CSG.roundedCylinder({start:[0,0,0],end:[0,l,0]}).setColor([0,1,0,g]),
773 CSG.roundedCylinder({start:[0,0,0],end:[0,0,l]}).setColor([0,0,1,g])
774 ]);
775}
776
777function P(x) {
778 return x.connectTo(x.properties.P,new CSG.Connector([0,0,0],[0,0,1],[1,0,0]), false, 0);
779}
780
781var PARTS = { 767var PARTS = {
782 wip: function(params) { 768 wip: function(params) {
783 return duetholder(params); 769 return duetholder(params);
784 return PARTS.alltogethernow(params); 770 return PARTS.alltogethernow(params);
785 return base_extrusions(); 771 return base_extrusions();
786 return foot(); 772 return foot();
787 return union(base_extrusions(),column_extrusions(),duet().translate([0,-20,0])); 773 return union(base_extrusions(),column_extrusions(),duet().translate([0,-20,0]));
788 }, 774 },
789 alltogethernow: function(params) { 775 alltogethernow: function(params) {
790 var cols = columns(); 776 var cols = columns();
791 var sides = base_sides(); 777 var sides = base_sides();
792 var feet = THREEWINDS.map(function(w,i) { 778 var feet = THREEWINDS.map(function(w,i) {
793 var rv = foot(); 779 var rv = foot();
794 rv = rv.connectTo(rv.properties.c_column,cols[i].properties.c_bottom,false,0); 780 rv = rv.connectTo(rv.properties.c_column,cols[i].properties.c_bottom,false,0);
795 var s = shoe(); 781 var s = shoe();
796 s = s.connectTo(s.properties.c_foot,rv.properties.c_shoe,false,0); 782 s = s.connectTo(s.properties.c_foot,rv.properties.c_shoe,false,0);
797 return rv.union(s); 783 return rv.union(s);
798 }); 784 });
799 var dh = duetholder(); 785 var dh = duetholder();
800 var dhsw = dh.connectTo(dh.properties.c_h, 786 var dhsw = dh.connectTo(dh.properties.c_h,
801 new CSG.Connector([-CONFIG.duet.hole_spacing.x/2,-CD.base.mid_inscription_r,CONFIG.foot.h],[0,0,1],[1,0,0]), 787 new CSG.Connector([-CONFIG.duet.hole_spacing.x/2,-CD.base.mid_inscription_r,CONFIG.foot.h],[0,0,1],[1,0,0]),
802 false,0); 788 false,0);
803 var d = duet(); 789 var d = duet();
804 d = d.connectTo(d.properties.holes.c_sw,dhsw.properties.duet.c_sw,false,0); 790 d = d.connectTo(d.properties.holes.c_sw,dhsw.properties.duet.c_sw,false,0);
805 var dhse = dh.connectTo(dh.properties.duet.c_se,d.properties.holes.c_se,false,0); 791 var dhse = dh.connectTo(dh.properties.duet.c_se,d.properties.holes.c_se,false,0);
806 var dhne = dh.connectTo(dh.properties.duet.c_ne,d.properties.holes.c_ne,false,0); 792 var dhne = dh.connectTo(dh.properties.duet.c_ne,d.properties.holes.c_ne,false,0);
807 var dhnw = dh.connectTo(dh.properties.duet.c_nw,d.properties.holes.c_nw,false,0); 793 var dhnw = dh.connectTo(dh.properties.duet.c_nw,d.properties.holes.c_nw,false,0);
808 var rv = union(cols).union(sides.map(union)).union(feet).union([ 794 var rv = union(cols).union(sides.map(union)).union(feet).union([
809 d,dhsw,dhse,dhne,dhnw 795 d,dhsw,dhse,dhne,dhnw
810 ]); 796 ]);
811 var p = P(platform()); 797 var p = P(platform());
812 rv = rv.union(p); 798 rv = rv.union(p);
813 rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); 799 rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]);
814 return rv; 800 return rv;
815 }, 801 },
816 duetholder: function(params) { 802 duetholder: function(params) {
817 return duetholder(); 803 return duetholder();
818 }, 804 },
819 foot: foot, 805 foot: foot,
820 shoe: shoe 806 shoe: shoe
821}; 807};
822 808
823function main(params) { 809function main(params) {
824 var part = params.part && PARTS[params.part]; 810 var part = params.part && PARTS[params.part];
825 if(!part) return refaxes(); 811 if(!part) return refaxes();
826 var rv = P(part(params)); 812 var rv = P(part(params));
827 if(!params.print) rv = rv.union(refaxes()); 813 if(!params.print) rv = rv.union(refaxes());
828 return rv; 814 return rv;
829} 815}
830 816
831function _main(params) { 817function _main(params) {
832 var e = EFFECTOR.effector(); 818 var e = EFFECTOR.effector();
833 var hs = E3DV6.heatsink(); 819 var hs = E3DV6.heatsink();
834 hs = hs.connectTo(hs.properties.grove_connector,e.properties.grove_connector,false,0); 820 hs = hs.connectTo(hs.properties.grove_connector,e.properties.grove_connector,false,0);
835 var ms = microswitch(); 821 var ms = microswitch();
836 var hd = EFFECTOR.hinged({ 822 var hd = EFFECTOR.hinged({
837 microswitch:ms,effector:e 823 microswitch:ms,effector:e
838 }); 824 });
839 ms = ms.connectTo( 825 ms = ms.connectTo(
840 ms.properties.screw_connector[0], 826 ms.properties.screw_connector[0],
841 hd.properties.microswitch_screw_connector[0], 827 hd.properties.microswitch_screw_connector[0],
842 false, 0); 828 false, 0);
843 var hdhd = EFFECTOR.split_hinged(hd); 829 var hdhd = EFFECTOR.split_hinged(hd);
844 var fh = EFFECTOR.fanholder(); 830 var fh = EFFECTOR.fanholder();
845 return union({ 831 return union({
846 platform: e, 832 platform: e,
847 hinged: hdhd[1], 833 hinged: hdhd[1],
848 clamp: hdhd[0], 834 clamp: hdhd[0],
849 fanholder: fh, 835 fanholder: fh,
850 alltogethernow: [e,hdhd[0],hdhd[1], columns(),hs,ms,fh] 836 alltogethernow: [e,hdhd[0],hdhd[1], columns(),hs,ms,fh]
851 }[params.part||'alltogethernow']) 837 }[params.part||'alltogethernow'])
852 var rv = union( 838 var rv = union(
853 e, 839 e,
854 hs, 840 hs,
855 columns(), 841 columns(),
856 ///hd, 842 ///hd,
857 hdhd[0], hdhd[1], 843 hdhd[0], hdhd[1],
858 ms); 844 ms);
859 return rv; 845 return rv;
860} 846}
861 847
848function refaxes(o) {
849 if(!o) o = {};
850 var l = o.l||20, g = o.g||0.7;
851 return union([
852 CSG.roundedCylinder({start:[0,0,0],end:[l,0,0]}).setColor([1,0,0,g]),
853 CSG.roundedCylinder({start:[0,0,0],end:[0,l,0]}).setColor([0,1,0,g]),
854 CSG.roundedCylinder({start:[0,0,0],end:[0,0,l]}).setColor([0,0,1,g])
855 ]);
856}
857
858function P(x) {
859 return x.connectTo(x.properties.P,new CSG.Connector([0,0,0],[0,0,1],[1,0,0]), false, 0);
860}
861
862
862function getParameterDefinitions() { 863function getParameterDefinitions() {
863 return [{ 864 return [{
864 name: 'part', 865 name: 'part',
865 type: 'choice', 866 type: 'choice',
866 values: [ 867 values: [
867 'platform', 868 'platform',
868 'hinged', 869 'hinged',
869 'clamp', 870 'clamp',
870 'fanholder', 871 'fanholder',
871 'duetholder', 872 'duetholder',
872 'foot', 'shoe', 873 'foot', 'shoe',
873 'alltogethernow', 874 'alltogethernow',
874 'wip' 875 'wip'
875 ], 876 ],
876 captions: [ 877 captions: [
877 'Effector platform', 878 'Effector platform',
878 'Hinged part', 879 'Hinged part',
879 'Clamp', 880 'Clamp',
880 'Fan holder', 881 'Fan holder',
881 'Duet holder', 882 'Duet holder',
882 'Foot', 883 'Foot',
883 'Shoe', 884 'Shoe',
884 'All together now!', 885 'All together now!',
885 'Work in progress' 886 'Work in progress'
886 ], 887 ],
887 caption: 'Part', 888 caption: 'Part',
888 initial: 'wip' 889 initial: 'wip'
889 },{ 890 },{
890 name: 'print', 891 name: 'print',
891 type: 'checkbox', 892 type: 'checkbox',
892 caption: 'For print, no nonsense', 893 caption: 'For print, no nonsense',
893 initial: false 894 initial: false
894 }]; 895 }];
895} 896}
896 897
897/* vim:set ft=javascript ai: */ 898/* vim:set ft=javascript ai: */