author | Michael Krelin <hacker@klever.net> | 2016-01-08 22:11:51 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2016-01-08 22:11:51 (UTC) |
commit | 59a7256a88fecb14ee79f47d49abdc34df665b81 (patch) (unidiff) | |
tree | 2e1f25ddd7026d1970f8fa7064d6e6d7e5c7341b | |
parent | 9ef193aea9128ec113cfbec7f7eca7e6e51be5be (diff) | |
download | redelta-59a7256a88fecb14ee79f47d49abdc34df665b81.zip redelta-59a7256a88fecb14ee79f47d49abdc34df665b81.tar.gz redelta-59a7256a88fecb14ee79f47d49abdc34df665b81.tar.bz2 |
duetholder math
-rw-r--r-- | delta.jscad | 10 |
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 | |||
@@ -1,247 +1,257 @@ | |||
1 | var PRINT = { | 1 | var PRINT = { |
2 | layer_height: 0.2, | 2 | layer_height: 0.2, |
3 | extrusion_width: 0.4, | 3 | extrusion_width: 0.4, |
4 | 4 | ||
5 | fit_tolerance: .2, slide_tolerance: .4, play_tolerance: .6 | 5 | fit_tolerance: .2, slide_tolerance: .4, play_tolerance: .6 |
6 | }; | 6 | }; |
7 | 7 | ||
8 | var CONFIG = { | 8 | var CONFIG = { |
9 | extrusion: { | 9 | extrusion: { |
10 | w: 20, slotdepth: 6 | 10 | w: 20, slotdepth: 6 |
11 | }, | 11 | }, |
12 | base: { | 12 | base: { |
13 | el: 240, // side extrusion length | 13 | el: 240, // side extrusion length |
14 | sl: 240+2*70, // triangle side length | 14 | sl: 240+2*70, // triangle side length |
15 | gap: 9 // vertical gap between side extrusions | 15 | gap: 9 // vertical gap between side extrusions |
16 | }, | 16 | }, |
17 | column: { | 17 | column: { |
18 | h: 600 // column height | 18 | h: 600 // column height |
19 | }, | 19 | }, |
20 | heatbed: { | 20 | heatbed: { |
21 | r: 220/2, // heatbed radius | 21 | r: 220/2, // heatbed radius |
22 | sr: 220/2-4.5,// radius of the screwholes circle | 22 | sr: 220/2-4.5,// radius of the screwholes circle |
23 | h: 3+1.5 // thickness (including insulation) | 23 | h: 3+1.5 // thickness (including insulation) |
24 | }, | 24 | }, |
25 | glass: { | 25 | glass: { |
26 | r: 195/2, // glass radius | 26 | r: 195/2, // glass radius |
27 | h: 3 // glass thickness | 27 | h: 3 // glass thickness |
28 | }, | 28 | }, |
29 | duet: { | 29 | duet: { |
30 | pcb_size: { x: 124, y: 100, z: 1 }, | 30 | pcb_size: { x: 124, y: 100, z: 1 }, |
31 | hole_spacing: { x: 115, y: 92 }, | 31 | hole_spacing: { x: 115, y: 92 }, |
32 | h: 30 | 32 | h: 30 |
33 | }, | 33 | }, |
34 | foot: { | 34 | foot: { |
35 | d: 20*Math.sqrt(2), h: 30, | 35 | d: 20*Math.sqrt(2), h: 30, |
36 | bolt: { d:5, l: 19, hd: 10 }, | 36 | bolt: { d:5, l: 19, hd: 10 }, |
37 | margin: 2.5, | 37 | margin: 2.5, |
38 | nut: { d: 8.6 /* TODO: */, h: 3.5 }, | 38 | nut: { d: 8.6 /* TODO: */, h: 3.5 }, |
39 | shell: 4, | 39 | shell: 4, |
40 | zscalefactor: 1.6, | 40 | zscalefactor: 1.6, |
41 | foot: { ho: 2.5, hi: 5 } | 41 | foot: { ho: 2.5, hi: 5 } |
42 | }, | 42 | }, |
43 | duetholder: { | 43 | duetholder: { |
44 | bolt: { d: 3, l: 10, head: { d: 5.33, h: 3 } }, | 44 | bolt: { d: 3, l: 10, head: { d: 5.33, h: 3 } }, |
45 | margin: 3, | 45 | margin: 3, |
46 | s: 2.5 | 46 | s: 2.5 |
47 | }, | 47 | }, |
48 | hotend: { | 48 | hotend: { |
49 | h: 62.4, // full assembly height | 49 | h: 62.4, // full assembly height |
50 | groove: { d:12, h:6 }, // grove diameter and height | 50 | groove: { d:12, h:6 }, // grove diameter and height |
51 | ungroove: { d:16, above:3.7, below: 3+4 } | 51 | ungroove: { d:16, above:3.7, below: 3+4 } |
52 | }, | 52 | }, |
53 | effector: { | 53 | effector: { |
54 | h: 6, | 54 | h: 6, |
55 | o: 20,// offset to the rod mounts line | 55 | o: 20,// offset to the rod mounts line |
56 | rods_apart: 40, | 56 | rods_apart: 40, |
57 | cone: { shell: 1, angle: Math.PI/6 }, | 57 | cone: { shell: 1, angle: Math.PI/6 }, |
58 | rodend: { | 58 | rodend: { |
59 | joint_w: 7,// thickness of the joint | 59 | joint_w: 7,// thickness of the joint |
60 | screw_l: 20-1, // 20 with the head | 60 | screw_l: 20-1, // 20 with the head |
61 | screw_d: 3 | 61 | screw_d: 3 |
62 | }, | 62 | }, |
63 | hotend: { margin: 2 }, | 63 | hotend: { margin: 2 }, |
64 | hinge: { | 64 | hinge: { |
65 | d: 3, w: 5, margin: 2.5, | 65 | d: 3, w: 5, margin: 2.5, |
66 | h: 1+(6+3.7)/2, // elevation + grove + top | 66 | h: 1+(6+3.7)/2, // elevation + grove + top |
67 | e: 1 // elevation | 67 | e: 1 // elevation |
68 | }, | 68 | }, |
69 | clamp: { | 69 | clamp: { |
70 | shell: 4.6, | 70 | shell: 4.6, |
71 | d: 3, | 71 | d: 3, |
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 | ||
105 | var CD = { | 105 | var 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 | ||
123 | var U = { | 133 | var 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:} */ |
134 | function nut(o) { | 144 | function 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 | ||
144 | var E3DV6 = { | 154 | var 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], |
168 | radiusStart: 10/2, radiusEnd: 8.5/2, /* pretty arbitrary */ | 178 | radiusStart: 10/2, radiusEnd: 8.5/2, /* pretty arbitrary */ |
169 | resolution: fn | 179 | resolution: fn |
170 | })); | 180 | })); |
171 | var rv = union(unite); | 181 | var rv = union(unite); |
172 | rv = rv.subtract([CSG.cylinder({ | 182 | rv = rv.subtract([CSG.cylinder({ |
173 | start:[0,0,1], end: [0,0,z-1], | 183 | start:[0,0,1], end: [0,0,z-1], |
174 | radius: 4.2/2, resolution: fn | 184 | radius: 4.2/2, resolution: fn |
175 | }),CSG.cylinder({ | 185 | }),CSG.cylinder({ |
176 | start:[0,0,1], end: [0,0,-6.7/*somewhat arbitrary*/], | 186 | start:[0,0,1], end: [0,0,-6.7/*somewhat arbitrary*/], |
177 | radius: 8/2, resolution: fn | 187 | radius: 8/2, resolution: fn |
178 | }),CSG.cylinder({ | 188 | }),CSG.cylinder({ |
179 | start:[0,0,z-1], end: [0,0,z+14.8], | 189 | start:[0,0,z-1], end: [0,0,z+14.8], |
180 | radius: 6/2 /*M7*/, resolution: fn | 190 | radius: 6/2 /*M7*/, resolution: fn |
181 | })]); | 191 | })]); |
182 | rv.properties.pushfit_connector = new CSG.Connector([0,0,0],[0,0,-1],[1,0,0]); | 192 | rv.properties.pushfit_connector = new CSG.Connector([0,0,0],[0,0,-1],[1,0,0]); |
183 | rv.properties.heatbreak_connector = new CSG.Connector([0,0,z+14.8],[0,0,-1],[1,0,0]); | 193 | rv.properties.heatbreak_connector = new CSG.Connector([0,0,z+14.8],[0,0,-1],[1,0,0]); |
184 | rv.properties.grove_connector = new CSG.Connector([0,0,-3.7-3],[0,0,1],[1,0,0]); | 194 | rv.properties.grove_connector = new CSG.Connector([0,0,-3.7-3],[0,0,1],[1,0,0]); |
185 | return rv.setColor([0.8,0.8,0.8,0.9]); | 195 | return rv.setColor([0.8,0.8,0.8,0.9]); |
186 | } | 196 | } |
187 | }; | 197 | }; |
188 | 198 | ||
189 | var EFFECTOR = { | 199 | var EFFECTOR = { |
190 | /* {sd: screw diameter, l: cone length, s: screw shell, a: angle from axis} */ | 200 | /* {sd: screw diameter, l: cone length, s: screw shell, a: angle from axis} */ |
191 | cone: function effector_cone(o) { | 201 | cone: function effector_cone(o) { |
192 | var re = o.sd/2+o.s, rs = re+o.l*Math.tan(o.a||(Math.PI/4)); | 202 | var re = o.sd/2+o.s, rs = re+o.l*Math.tan(o.a||(Math.PI/4)); |
193 | var rv = CSG.cylinder({ | 203 | var rv = CSG.cylinder({ |
194 | start: [0,0,0], end: [0,0,o.l], | 204 | start: [0,0,0], end: [0,0,o.l], |
195 | radiusStart: rs, radiusEnd: re, | 205 | radiusStart: rs, radiusEnd: re, |
196 | resolution: Math.floor(rs*2*2) | 206 | resolution: Math.floor(rs*2*2) |
197 | }).subtract(CSG.cylinder({ | 207 | }).subtract(CSG.cylinder({ |
198 | start:[0,0,-1], end:[0,0,o.l+1], radius: o.sd, | 208 | start:[0,0,-1], end:[0,0,o.l+1], radius: o.sd, |
199 | //resolution: Math.floor(o.sd*2*2) | 209 | //resolution: Math.floor(o.sd*2*2) |
200 | })); | 210 | })); |
201 | rv.properties.top_connector = new CSG.Connector([0,0,o.l],[0,0,-1],[1,0,0]); | 211 | rv.properties.top_connector = new CSG.Connector([0,0,o.l],[0,0,-1],[1,0,0]); |
202 | rv.properties.bottom_connector = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); | 212 | rv.properties.bottom_connector = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); |
203 | var nuthole = nut(CONFIG.nut); | 213 | var nuthole = nut(CONFIG.nut); |
204 | rv = rv.subtract(nuthole.connectTo( | 214 | rv = rv.subtract(nuthole.connectTo( |
205 | nuthole.properties.axis_connector, rv.properties.bottom_connector, | 215 | nuthole.properties.axis_connector, rv.properties.bottom_connector, |
206 | false, 0 | 216 | false, 0 |
207 | )); | 217 | )); |
208 | return rv.intersect(CSG.cylinder({start:[0,0,0],end:[0,0,o.l],radius:6/*TODO:calculate*/})); | 218 | return rv.intersect(CSG.cylinder({start:[0,0,0],end:[0,0,o.l],radius:6/*TODO:calculate*/})); |
209 | }, | 219 | }, |
210 | platform_bb: function platform_bb() { | 220 | platform_bb: function platform_bb() { |
211 | var e = CONFIG.effector; | 221 | var e = CONFIG.effector; |
212 | var r = U.hypotenuse(e.rods_apart/2,e.o+e.rodend.screw_d/2+e.cone.shell); | 222 | var r = U.hypotenuse(e.rods_apart/2,e.o+e.rodend.screw_d/2+e.cone.shell); |
213 | var rv = CSG.sphere({ | 223 | var rv = CSG.sphere({ |
214 | center: [0,0,e.h/2], radius: r, | 224 | center: [0,0,e.h/2], radius: r, |
215 | resolution: r*2*2 | 225 | resolution: r*2*2 |
216 | }).intersect(CSG.cube({ | 226 | }).intersect(CSG.cube({ |
217 | corner1: [-r,-r,0], corner2: [r,r,e.h] | 227 | corner1: [-r,-r,0], corner2: [r,r,e.h] |
218 | })); | 228 | })); |
219 | rv.properties.base_connector = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); | 229 | rv.properties.base_connector = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); |
220 | return rv; | 230 | return rv; |
221 | }, | 231 | }, |
222 | effector: function effector_effector() { | 232 | effector: function effector_effector() { |
223 | var e = CONFIG.effector; | 233 | var e = CONFIG.effector; |
224 | var conel = e.rodend.screw_l-e.rodend.joint_w; | 234 | var conel = e.rodend.screw_l-e.rodend.joint_w; |
225 | var nutr = CONFIG.nut.w/2/Math.cos(Math.PI/6); | 235 | var nutr = CONFIG.nut.w/2/Math.cos(Math.PI/6); |
226 | var cone = this.cone({sd:e.rodend.screw_d/2,l:conel,s:e.cone.shell,a:e.cone.angle}); | 236 | var cone = this.cone({sd:e.rodend.screw_d/2,l:conel,s:e.cone.shell,a:e.cone.angle}); |
227 | var rcorner = U.hypotenuse(e.o-e.rodend.screw_d/2-e.cone.shell,e.rods_apart/2)-3.85; //XXX:config/calc | 237 | var rcorner = U.hypotenuse(e.o-e.rodend.screw_d/2-e.cone.shell,e.rods_apart/2)-3.85; //XXX:config/calc |
228 | var ropen = E3DV6.dimensions.big_d/2+e.hotend.margin; | 238 | var ropen = E3DV6.dimensions.big_d/2+e.hotend.margin; |
229 | var rmount = this.rmount = (rcorner+ropen)/2; | 239 | var rmount = this.rmount = (rcorner+ropen)/2; |
230 | var rv = []; | 240 | var rv = []; |
231 | for(var a=0;a<360;a+=120) { | 241 | for(var a=0;a<360;a+=120) { |
232 | rv.push(union([-1,1].map(function(s) { | 242 | rv.push(union([-1,1].map(function(s) { |
233 | return cone.connectTo(cone.properties.top_connector, | 243 | return cone.connectTo(cone.properties.top_connector, |
234 | new CSG.Connector([s*e.rods_apart/2,e.o,e.h/2],[-s,0,0],[0,0,1]), | 244 | new CSG.Connector([s*e.rods_apart/2,e.o,e.h/2],[-s,0,0],[0,0,1]), |
235 | false, 0); | 245 | false, 0); |
236 | })).union(CSG.cube({ | 246 | })).union(CSG.cube({ |
237 | corner1:[e.rods_apart/2-conel+.1,e.o-nutr,0], | 247 | corner1:[e.rods_apart/2-conel+.1,e.o-nutr,0], |
238 | corner2:[-e.rods_apart/2+conel-.1, | 248 | corner2:[-e.rods_apart/2+conel-.1, |
239 | -rcorner, | 249 | -rcorner, |
240 | e.h] | 250 | e.h] |
241 | })).rotateZ(a)); | 251 | })).rotateZ(a)); |
242 | } | 252 | } |
243 | rv.push(CSG.cylinder({ | 253 | rv.push(CSG.cylinder({ |
244 | start:[0,0,0], end:[0,0,e.h], | 254 | start:[0,0,0], end:[0,0,e.h], |
245 | radius: U.hypotenuse(e.o-nutr,e.rods_apart/2-conel) | 255 | radius: U.hypotenuse(e.o-nutr,e.rods_apart/2-conel) |
246 | })); | 256 | })); |
247 | rv = union(rv).intersect(this.platform_bb()).subtract(CSG.cylinder({ | 257 | rv = union(rv).intersect(this.platform_bb()).subtract(CSG.cylinder({ |