summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2016-01-08 22:11:51 (UTC)
committer Michael Krelin <hacker@klever.net>2016-01-08 22:11:51 (UTC)
commit59a7256a88fecb14ee79f47d49abdc34df665b81 (patch) (unidiff)
tree2e1f25ddd7026d1970f8fa7064d6e6d7e5c7341b
parent9ef193aea9128ec113cfbec7f7eca7e6e51be5be (diff)
downloadredelta-59a7256a88fecb14ee79f47d49abdc34df665b81.zip
redelta-59a7256a88fecb14ee79f47d49abdc34df665b81.tar.gz
redelta-59a7256a88fecb14ee79f47d49abdc34df665b81.tar.bz2
duetholder math
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--delta.jscad10
1 files changed, 10 insertions, 0 deletions
diff --git a/delta.jscad b/delta.jscad
index 4716875..a1be156 100644
--- a/delta.jscad
+++ b/delta.jscad
@@ -72,96 +72,106 @@ var CONFIG = {
72 margin: 2.5, 72 margin: 2.5,
73 split: 0.6 73 split: 0.6
74 }, 74 },
75 mswitch: { 75 mswitch: {
76 size: [ 19.8, 6, 10 ], 76 size: [ 19.8, 6, 10 ],
77 screw: { 77 screw: {
78 d: 2, h: 10/2-2, 78 d: 2, h: 10/2-2,
79 s: 1.3, // screw shell 79 s: 1.3, // screw shell
80 o: [-9.5/2,9.5/2].map(function(x) { 80 o: [-9.5/2,9.5/2].map(function(x) {
81 return -19.8/2+x; 81 return -19.8/2+x;
82 }) 82 })
83 }, 83 },
84 switch_x: 2.5 84 switch_x: 2.5
85 }, 85 },
86 guide: { 86 guide: {
87 width: 3, height: 5+1, length: 6 87 width: 3, height: 5+1, length: 6
88 }, 88 },
89 fanholder: { 89 fanholder: {
90 r: 30, 90 r: 30,
91 screw: { d: 3, m: 2.5/*margin*/ }, 91 screw: { d: 3, m: 2.5/*margin*/ },
92 w: 3 92 w: 3
93 } 93 }
94 }, 94 },
95 nut: { h: 2.3, w: 5.5 }, 95 nut: { h: 2.3, w: 5.5 },
96 color: { 96 color: {
97 extrusion: [0.8, 0.8, 0.8, 0.8], 97 extrusion: [0.8, 0.8, 0.8, 0.8],
98 pcb: [ 0, 0.3, 0.2, 0.8 ], 98 pcb: [ 0, 0.3, 0.2, 0.8 ],
99 bulk: [ .9, .9, .9, .2 ], 99 bulk: [ .9, .9, .9, .2 ],
100 parts: [ 0, 0.8, 0, 0.9 ], 100 parts: [ 0, 0.8, 0, 0.9 ],
101 softparts: [ 0, 0, 0.8, 0.9 ] 101 softparts: [ 0, 0, 0.8, 0.9 ]
102 } 102 }
103}; 103};
104 104
105var CD = { 105var CD = {
106 base: (function(){ 106 base: (function(){
107 var rv = {}; 107 var rv = {};
108 rv.circumscription_r = 108 rv.circumscription_r =
109 CONFIG.base.sl/2/Math.cos(Math.PI/6); 109 CONFIG.base.sl/2/Math.cos(Math.PI/6);
110 rv.outer_inscription_r = 110 rv.outer_inscription_r =
111 Math.sqrt(Math.pow(rv.circumscription_r,2)- 111 Math.sqrt(Math.pow(rv.circumscription_r,2)-
112 Math.pow(CONFIG.base.sl/2,2)); 112 Math.pow(CONFIG.base.sl/2,2));
113 rv.mid_inscription_r = 113 rv.mid_inscription_r =
114 rv.outer_inscription_r-CONFIG.extrusion.w/2; 114 rv.outer_inscription_r-CONFIG.extrusion.w/2;
115 rv.inner_inscription_r = 115 rv.inner_inscription_r =
116 rv.outer_inscription_r-CONFIG.extrusion.w/2; 116 rv.outer_inscription_r-CONFIG.extrusion.w/2;
117 // TODO: properly calculate 117 // TODO: properly calculate
118 rv.column_r = rv.circumscription_r - 48.29; 118 rv.column_r = rv.circumscription_r - 48.29;
119 return rv; 119 return rv;
120 })(),
121 duetholder: (function() {
122 var rv = {};
123 var s = CONFIG.base.sl;
124 var l = CONFIG.duet.hole_spacing.x;
125 var w = CONFIG.duet.hole_spacing.y;
126 var h = s*Math.cos(Math.PI/6);
127 var h1 = h*(1-l/s);
128 rv.distance = (h1-w)/3; // hole to side
129 return rv;
120 })() 130 })()
121}; 131};
122 132
123var U = { 133var U = {
124 hypotenuse: function(a,b) { 134 hypotenuse: function(a,b) {
125 return Math.sqrt(Math.pow(a,2)+Math.pow(b,2)); 135 return Math.sqrt(Math.pow(a,2)+Math.pow(b,2));
126 }, 136 },
127 peek: function(x,m) { 137 peek: function(x,m) {
128 console.log(x,m); 138 console.log(x,m);
129 return x; 139 return x;
130 } 140 }
131}; 141};
132 142
133/* {h:,w:} */ 143/* {h:,w:} */
134function nut(o) { 144function nut(o) {
135 var rv = CSG.cylinder({ 145 var rv = CSG.cylinder({
136 start:[0,0,0],end:[0,0,o.h], 146 start:[0,0,0],end:[0,0,o.h],
137 radius: o.w/2/Math.cos(Math.PI/6), 147 radius: o.w/2/Math.cos(Math.PI/6),
138 resolution: 6 148 resolution: 6
139 }); 149 });
140 rv.properties.axis_connector = new CSG.Connector([0,0,0],[0,0,1],[0,1,0]); 150 rv.properties.axis_connector = new CSG.Connector([0,0,0],[0,0,1],[0,1,0]);
141 return rv; 151 return rv;
142} 152}
143 153
144var E3DV6 = { 154var E3DV6 = {
145 dimensions: { 155 dimensions: {
146 big_d: 22.3, 156 big_d: 22.3,
147 157
148 }, 158 },
149 heatsink: function() { 159 heatsink: function() {
150 var fn = 16; 160 var fn = 16;
151 var z=0; 161 var z=0;
152 var unite = [ {d:16,h:3.7},{d:12,h:6},{d:16,h:3} ].map(function(x) { 162 var unite = [ {d:16,h:3.7},{d:12,h:6},{d:16,h:3} ].map(function(x) {
153 return CSG.cylinder({ 163 return CSG.cylinder({
154 start: [0,0,z], end: [0,0,z-=x.h], 164 start: [0,0,z], end: [0,0,z-=x.h],
155 radius: x.d/2, resolution: fn 165 radius: x.d/2, resolution: fn
156 }); 166 });
157 }); 167 });
158 unite.push(CSG.cylinder({ 168 unite.push(CSG.cylinder({
159 start:[0,0,z-=1.5], end:[0,0,z-=1], 169 start:[0,0,z-=1.5], end:[0,0,z-=1],
160 radius: 16/2, resolution: fn 170 radius: 16/2, resolution: fn
161 })); 171 }));
162 for(var i=0;i<11;++i) unite.push(CSG.cylinder({ 172 for(var i=0;i<11;++i) unite.push(CSG.cylinder({
163 start:[0,0,z-=1.5], end:[0,0,z-=1], 173 start:[0,0,z-=1.5], end:[0,0,z-=1],
164 radius: this.dimensions.big_d/2, resolution: fn 174 radius: this.dimensions.big_d/2, resolution: fn
165 })); 175 }));
166 unite.push(CSG.cylinder({ 176 unite.push(CSG.cylinder({
167 start:[0,0,z], end: [0,0,-12.7], 177 start:[0,0,z], end: [0,0,-12.7],