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
@@ -853,198 +853,199 @@ function bedholder(params) {
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: */