-rw-r--r-- | delta.jscad | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/delta.jscad b/delta.jscad index 83122af..54f1f86 100644 --- a/delta.jscad +++ b/delta.jscad | |||
@@ -1,293 +1,295 @@ | |||
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 | heatbed: [0.8, 0.8, 0.8, 0.8 ], | ||
103 | glass: [0.9, 0.9, 0.9, 0.7 ] | ||
102 | } | 104 | } |
103 | }; | 105 | }; |
104 | 106 | ||
105 | var CD = { | 107 | var CD = { |
106 | base: (function(){ | 108 | base: (function(){ |
107 | var rv = {}; | 109 | var rv = {}; |
108 | rv.circumscription_r = | 110 | rv.circumscription_r = |
109 | CONFIG.base.sl/2/Math.cos(Math.PI/6); | 111 | CONFIG.base.sl/2/Math.cos(Math.PI/6); |
110 | rv.outer_inscription_r = | 112 | rv.outer_inscription_r = |
111 | Math.sqrt(Math.pow(rv.circumscription_r,2)- | 113 | Math.sqrt(Math.pow(rv.circumscription_r,2)- |
112 | Math.pow(CONFIG.base.sl/2,2)); | 114 | Math.pow(CONFIG.base.sl/2,2)); |
113 | rv.mid_inscription_r = | 115 | rv.mid_inscription_r = |
114 | rv.outer_inscription_r-CONFIG.extrusion.w/2; | 116 | rv.outer_inscription_r-CONFIG.extrusion.w/2; |
115 | rv.inner_inscription_r = | 117 | rv.inner_inscription_r = |
116 | rv.outer_inscription_r-CONFIG.extrusion.w; | 118 | rv.outer_inscription_r-CONFIG.extrusion.w; |
117 | // TODO: properly calculate | 119 | // TODO: properly calculate |
118 | rv.column_r = rv.circumscription_r - 48.29; | 120 | rv.column_r = rv.circumscription_r - 48.29; |
119 | return rv; | 121 | return rv; |
120 | })(), | 122 | })(), |
121 | duetholder: (function() { | 123 | duetholder: (function() { |
122 | var rv = {}; | 124 | var rv = {}; |
123 | var s = CONFIG.base.sl; | 125 | var s = CONFIG.base.sl; |
124 | var l = CONFIG.duet.hole_spacing.x; | 126 | var l = CONFIG.duet.hole_spacing.x; |
125 | var w = CONFIG.duet.hole_spacing.y; | 127 | var w = CONFIG.duet.hole_spacing.y; |
126 | var h = s*Math.cos(Math.PI/6); | 128 | var h = s*Math.cos(Math.PI/6); |
127 | var h1 = h*(1-l/s); | 129 | var h1 = h*(1-l/s); |
128 | rv.distance = (h1-w)/3; // hole to side | 130 | rv.distance = (h1-w)/3; // hole to side |
129 | return rv; | 131 | return rv; |
130 | })() | 132 | })() |
131 | }; | 133 | }; |
132 | console.log(CONFIG); console.log(CD); | 134 | console.log(CONFIG); console.log(CD); |
133 | 135 | ||
134 | var U = { | 136 | var U = { |
135 | hypotenuse: function(a,b) { | 137 | hypotenuse: function(a,b) { |
136 | return Math.sqrt(Math.pow(a,2)+Math.pow(b,2)); | 138 | return Math.sqrt(Math.pow(a,2)+Math.pow(b,2)); |
137 | }, | 139 | }, |
138 | peek: function(x,m) { | 140 | peek: function(x,m) { |
139 | console.log(x,m); | 141 | console.log(x,m); |
140 | return x; | 142 | return x; |
141 | } | 143 | } |
142 | }; | 144 | }; |
143 | 145 | ||
144 | /* {h:,w:} */ | 146 | /* {h:,w:} */ |
145 | function nut(o) { | 147 | function nut(o) { |
146 | var rv = CSG.cylinder({ | 148 | var rv = CSG.cylinder({ |
147 | start:[0,0,0],end:[0,0,o.h], | 149 | start:[0,0,0],end:[0,0,o.h], |
148 | radius: o.w/2/Math.cos(Math.PI/6), | 150 | radius: o.w/2/Math.cos(Math.PI/6), |
149 | resolution: 6 | 151 | resolution: 6 |
150 | }); | 152 | }); |
151 | rv.properties.axis_connector = new CSG.Connector([0,0,0],[0,0,1],[0,1,0]); | 153 | rv.properties.axis_connector = new CSG.Connector([0,0,0],[0,0,1],[0,1,0]); |
152 | return rv; | 154 | return rv; |
153 | } | 155 | } |
154 | 156 | ||
155 | var E3DV6 = { | 157 | var E3DV6 = { |
156 | dimensions: { | 158 | dimensions: { |
157 | big_d: 22.3, | 159 | big_d: 22.3, |
158 | 160 | ||
159 | }, | 161 | }, |
160 | heatsink: function() { | 162 | heatsink: function() { |
161 | var fn = 16; | 163 | var fn = 16; |
162 | var z=0; | 164 | var z=0; |
163 | var unite = [ {d:16,h:3.7},{d:12,h:6},{d:16,h:3} ].map(function(x) { | 165 | var unite = [ {d:16,h:3.7},{d:12,h:6},{d:16,h:3} ].map(function(x) { |
164 | return CSG.cylinder({ | 166 | return CSG.cylinder({ |
165 | start: [0,0,z], end: [0,0,z-=x.h], | 167 | start: [0,0,z], end: [0,0,z-=x.h], |
166 | radius: x.d/2, resolution: fn | 168 | radius: x.d/2, resolution: fn |
167 | }); | 169 | }); |
168 | }); | 170 | }); |
169 | unite.push(CSG.cylinder({ | 171 | unite.push(CSG.cylinder({ |
170 | start:[0,0,z-=1.5], end:[0,0,z-=1], | 172 | start:[0,0,z-=1.5], end:[0,0,z-=1], |
171 | radius: 16/2, resolution: fn | 173 | radius: 16/2, resolution: fn |
172 | })); | 174 | })); |
173 | for(var i=0;i<11;++i) unite.push(CSG.cylinder({ | 175 | for(var i=0;i<11;++i) unite.push(CSG.cylinder({ |
174 | start:[0,0,z-=1.5], end:[0,0,z-=1], | 176 | start:[0,0,z-=1.5], end:[0,0,z-=1], |
175 | radius: this.dimensions.big_d/2, resolution: fn | 177 | radius: this.dimensions.big_d/2, resolution: fn |
176 | })); | 178 | })); |
177 | unite.push(CSG.cylinder({ | 179 | unite.push(CSG.cylinder({ |
178 | start:[0,0,z], end: [0,0,-12.7], | 180 | start:[0,0,z], end: [0,0,-12.7], |
179 | radiusStart: 10/2, radiusEnd: 8.5/2, /* pretty arbitrary */ | 181 | radiusStart: 10/2, radiusEnd: 8.5/2, /* pretty arbitrary */ |
180 | resolution: fn | 182 | resolution: fn |
181 | })); | 183 | })); |
182 | var rv = union(unite); | 184 | var rv = union(unite); |
183 | rv = rv.subtract([CSG.cylinder({ | 185 | rv = rv.subtract([CSG.cylinder({ |
184 | start:[0,0,1], end: [0,0,z-1], | 186 | start:[0,0,1], end: [0,0,z-1], |
185 | radius: 4.2/2, resolution: fn | 187 | radius: 4.2/2, resolution: fn |
186 | }),CSG.cylinder({ | 188 | }),CSG.cylinder({ |
187 | start:[0,0,1], end: [0,0,-6.7/*somewhat arbitrary*/], | 189 | start:[0,0,1], end: [0,0,-6.7/*somewhat arbitrary*/], |
188 | radius: 8/2, resolution: fn | 190 | radius: 8/2, resolution: fn |
189 | }),CSG.cylinder({ | 191 | }),CSG.cylinder({ |
190 | start:[0,0,z-1], end: [0,0,z+14.8], | 192 | start:[0,0,z-1], end: [0,0,z+14.8], |
191 | radius: 6/2 /*M7*/, resolution: fn | 193 | radius: 6/2 /*M7*/, resolution: fn |
192 | })]); | 194 | })]); |
193 | rv.properties.pushfit_connector = new CSG.Connector([0,0,0],[0,0,-1],[1,0,0]); | 195 | rv.properties.pushfit_connector = new CSG.Connector([0,0,0],[0,0,-1],[1,0,0]); |
194 | rv.properties.heatbreak_connector = new CSG.Connector([0,0,z+14.8],[0,0,-1],[1,0,0]); | 196 | rv.properties.heatbreak_connector = new CSG.Connector([0,0,z+14.8],[0,0,-1],[1,0,0]); |
195 | rv.properties.grove_connector = new CSG.Connector([0,0,-3.7-3],[0,0,1],[1,0,0]); | 197 | rv.properties.grove_connector = new CSG.Connector([0,0,-3.7-3],[0,0,1],[1,0,0]); |
196 | return rv.setColor([0.8,0.8,0.8,0.9]); | 198 | return rv.setColor([0.8,0.8,0.8,0.9]); |
197 | } | 199 | } |
198 | }; | 200 | }; |
199 | 201 | ||
200 | var EFFECTOR = { | 202 | var EFFECTOR = { |
201 | /* {sd: screw diameter, l: cone length, s: screw shell, a: angle from axis} */ | 203 | /* {sd: screw diameter, l: cone length, s: screw shell, a: angle from axis} */ |
202 | cone: function effector_cone(o) { | 204 | cone: function effector_cone(o) { |
203 | var re = o.sd/2+o.s, rs = re+o.l*Math.tan(o.a||(Math.PI/4)); | 205 | var re = o.sd/2+o.s, rs = re+o.l*Math.tan(o.a||(Math.PI/4)); |
204 | var rv = CSG.cylinder({ | 206 | var rv = CSG.cylinder({ |
205 | start: [0,0,0], end: [0,0,o.l], | 207 | start: [0,0,0], end: [0,0,o.l], |
206 | radiusStart: rs, radiusEnd: re, | 208 | radiusStart: rs, radiusEnd: re, |
207 | resolution: Math.floor(rs*2*2) | 209 | resolution: Math.floor(rs*2*2) |
208 | }).subtract(CSG.cylinder({ | 210 | }).subtract(CSG.cylinder({ |
209 | start:[0,0,-1], end:[0,0,o.l+1], radius: o.sd, | 211 | start:[0,0,-1], end:[0,0,o.l+1], radius: o.sd, |
210 | //resolution: Math.floor(o.sd*2*2) | 212 | //resolution: Math.floor(o.sd*2*2) |
211 | })); | 213 | })); |
212 | rv.properties.top_connector = new CSG.Connector([0,0,o.l],[0,0,-1],[1,0,0]); | 214 | rv.properties.top_connector = new CSG.Connector([0,0,o.l],[0,0,-1],[1,0,0]); |
213 | rv.properties.bottom_connector = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); | 215 | rv.properties.bottom_connector = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); |
214 | var nuthole = nut(CONFIG.nut); | 216 | var nuthole = nut(CONFIG.nut); |
215 | rv = rv.subtract(nuthole.connectTo( | 217 | rv = rv.subtract(nuthole.connectTo( |
216 | nuthole.properties.axis_connector, rv.properties.bottom_connector, | 218 | nuthole.properties.axis_connector, rv.properties.bottom_connector, |
217 | false, 0 | 219 | false, 0 |
218 | )); | 220 | )); |
219 | return rv.intersect(CSG.cylinder({start:[0,0,0],end:[0,0,o.l],radius:6/*TODO:calculate*/})); | 221 | return rv.intersect(CSG.cylinder({start:[0,0,0],end:[0,0,o.l],radius:6/*TODO:calculate*/})); |
220 | }, | 222 | }, |
221 | platform_bb: function platform_bb() { | 223 | platform_bb: function platform_bb() { |
222 | var e = CONFIG.effector; | 224 | var e = CONFIG.effector; |
223 | var r = U.hypotenuse(e.rods_apart/2,e.o+e.rodend.screw_d/2+e.cone.shell); | 225 | var r = U.hypotenuse(e.rods_apart/2,e.o+e.rodend.screw_d/2+e.cone.shell); |
224 | var rv = CSG.sphere({ | 226 | var rv = CSG.sphere({ |
225 | center: [0,0,e.h/2], radius: r, | 227 | center: [0,0,e.h/2], radius: r, |
226 | resolution: r*2*2 | 228 | resolution: r*2*2 |
227 | }).intersect(CSG.cube({ | 229 | }).intersect(CSG.cube({ |
228 | corner1: [-r,-r,0], corner2: [r,r,e.h] | 230 | corner1: [-r,-r,0], corner2: [r,r,e.h] |
229 | })); | 231 | })); |
230 | rv.properties.base_connector = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); | 232 | rv.properties.base_connector = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); |
231 | return rv; | 233 | return rv; |
232 | }, | 234 | }, |
233 | effector: function effector_effector() { | 235 | effector: function effector_effector() { |
234 | var e = CONFIG.effector; | 236 | var e = CONFIG.effector; |
235 | var conel = e.rodend.screw_l-e.rodend.joint_w; | 237 | var conel = e.rodend.screw_l-e.rodend.joint_w; |
236 | var nutr = CONFIG.nut.w/2/Math.cos(Math.PI/6); | 238 | var nutr = CONFIG.nut.w/2/Math.cos(Math.PI/6); |
237 | var cone = this.cone({sd:e.rodend.screw_d/2,l:conel,s:e.cone.shell,a:e.cone.angle}); | 239 | var cone = this.cone({sd:e.rodend.screw_d/2,l:conel,s:e.cone.shell,a:e.cone.angle}); |
238 | var rcorner = U.hypotenuse(e.o-e.rodend.screw_d/2-e.cone.shell,e.rods_apart/2)-3.85; //XXX:config/calc | 240 | var rcorner = U.hypotenuse(e.o-e.rodend.screw_d/2-e.cone.shell,e.rods_apart/2)-3.85; //XXX:config/calc |
239 | var ropen = E3DV6.dimensions.big_d/2+e.hotend.margin; | 241 | var ropen = E3DV6.dimensions.big_d/2+e.hotend.margin; |
240 | var rmount = this.rmount = (rcorner+ropen)/2; | 242 | var rmount = this.rmount = (rcorner+ropen)/2; |
241 | var rv = []; | 243 | var rv = []; |
242 | for(var a=0;a<360;a+=120) { | 244 | for(var a=0;a<360;a+=120) { |
243 | rv.push(union([-1,1].map(function(s) { | 245 | rv.push(union([-1,1].map(function(s) { |
244 | return cone.connectTo(cone.properties.top_connector, | 246 | return cone.connectTo(cone.properties.top_connector, |
245 | new CSG.Connector([s*e.rods_apart/2,e.o,e.h/2],[-s,0,0],[0,0,1]), | 247 | new CSG.Connector([s*e.rods_apart/2,e.o,e.h/2],[-s,0,0],[0,0,1]), |
246 | false, 0); | 248 | false, 0); |
247 | })).union(CSG.cube({ | 249 | })).union(CSG.cube({ |
248 | corner1:[e.rods_apart/2-conel+.1,e.o-nutr,0], | 250 | corner1:[e.rods_apart/2-conel+.1,e.o-nutr,0], |
249 | corner2:[-e.rods_apart/2+conel-.1, | 251 | corner2:[-e.rods_apart/2+conel-.1, |
250 | -rcorner, | 252 | -rcorner, |
251 | e.h] | 253 | e.h] |
252 | })).rotateZ(a)); | 254 | })).rotateZ(a)); |
253 | } | 255 | } |
254 | rv.push(CSG.cylinder({ | 256 | rv.push(CSG.cylinder({ |
255 | start:[0,0,0], end:[0,0,e.h], | 257 | start:[0,0,0], end:[0,0,e.h], |
256 | radius: U.hypotenuse(e.o-nutr,e.rods_apart/2-conel) | 258 | radius: U.hypotenuse(e.o-nutr,e.rods_apart/2-conel) |
257 | })); | 259 | })); |
258 | rv = union(rv).intersect(this.platform_bb()).subtract(CSG.cylinder({ | 260 | rv = union(rv).intersect(this.platform_bb()).subtract(CSG.cylinder({ |
259 | start:[0,0,-1], end:[0,0,e.h+1], | 261 | start:[0,0,-1], end:[0,0,e.h+1], |
260 | radius: ropen, resolution: ropen*4 | 262 | radius: ropen, resolution: ropen*4 |
261 | })).subtract([/*0, probe here*/120,240].map(function(x) { /* nut pockets */ | 263 | })).subtract([/*0, probe here*/120,240].map(function(x) { /* nut pockets */ |
262 | return CSG.cube({ | 264 | return CSG.cube({ |
263 | corner1:[-CONFIG.nut.w/2,0,(e.h-CONFIG.nut.h)/2], | 265 | corner1:[-CONFIG.nut.w/2,0,(e.h-CONFIG.nut.h)/2], |
264 | corner2:[CONFIG.nut.w/2,-rcorner-1,(e.h+CONFIG.nut.h)/2] | 266 | corner2:[CONFIG.nut.w/2,-rcorner-1,(e.h+CONFIG.nut.h)/2] |
265 | }).union(CSG.cylinder({ | 267 | }).union(CSG.cylinder({ |
266 | start:[0,-rmount,-1], end:[0,-rmount,e.h+1], | 268 | start:[0,-rmount,-1], end:[0,-rmount,e.h+1], |
267 | radius: 3/2 // XXX: | 269 | radius: 3/2 // XXX: |
268 | })).subtract(CSG.cylinder({ | 270 | })).subtract(CSG.cylinder({ |
269 | start:[0,-rmount,(e.h+CONFIG.nut.h)/2], | 271 | start:[0,-rmount,(e.h+CONFIG.nut.h)/2], |
270 | end:[0,-rmount,(e.h+CONFIG.nut.h)/2+PRINT.layer_height*3/2], | 272 | end:[0,-rmount,(e.h+CONFIG.nut.h)/2+PRINT.layer_height*3/2], |
271 | radius: 3/2+.1 | 273 | radius: 3/2+.1 |
272 | })).rotateZ(x); | 274 | })).rotateZ(x); |
273 | })).subtract( CSG.cylinder({ // pulldown screw | 275 | })).subtract( CSG.cylinder({ // pulldown screw |
274 | start: [0,-rcorner+e.mswitch.size[1]+PRINT.extrusion_width+3/2/*XXX:conf*/,-1], | 276 | start: [0,-rcorner+e.mswitch.size[1]+PRINT.extrusion_width+3/2/*XXX:conf*/,-1], |
275 | end: [0,-rcorner+e.mswitch.size[1]+PRINT.extrusion_width+3/2/*XXX:conf*/,e.h+1], | 277 | end: [0,-rcorner+e.mswitch.size[1]+PRINT.extrusion_width+3/2/*XXX:conf*/,e.h+1], |
276 | radius: 3/2+1 /*XXX: config */ | 278 | radius: 3/2+1 /*XXX: config */ |
277 | })).subtract( CSG.cylinder({ /* switch-screw */ | 279 | })).subtract( CSG.cylinder({ /* switch-screw */ |
278 | start: [e.mswitch.switch_x,-rcorner+e.mswitch.size[1]/2,-1], | 280 | start: [e.mswitch.switch_x,-rcorner+e.mswitch.size[1]/2,-1], |
279 | end: [e.mswitch.switch_x,-rcorner+e.mswitch.size[1]/2,e.h+1], | 281 | end: [e.mswitch.switch_x,-rcorner+e.mswitch.size[1]/2,e.h+1], |
280 | radius: e.mswitch.screw.d/2 | 282 | radius: e.mswitch.screw.d/2 |
281 | })); | 283 | })); |
282 | // add hinges | 284 | // add hinges |
283 | rv.properties.hinge_connector=new CSG.Properties(); | 285 | rv.properties.hinge_connector=new CSG.Properties(); |
284 | var hinges_apart=e.rods_apart/2-conel; | 286 | var hinges_apart=e.rods_apart/2-conel; |
285 | rv = rv.union([-1,1].map(function hinge(s) { | 287 | rv = rv.union([-1,1].map(function hinge(s) { |
286 | rv.properties.hinge_connector[s]=new CSG.Connector([s*hinges_apart,e.o,e.h+e.hinge.h],[s,0,0],[0,0,1]); | 288 | rv.properties.hinge_connector[s]=new CSG.Connector([s*hinges_apart,e.o,e.h+e.hinge.h],[s,0,0],[0,0,1]); |
287 | return CSG.cube({ | 289 | return CSG.cube({ |
288 | corner1: [s*hinges_apart,e.o-e.hinge.margin-e.hinge.d/2,e.h], | 290 | corner1: [s*hinges_apart,e.o-e.hinge.margin-e.hinge.d/2,e.h], |
289 | corner2: [s*(hinges_apart+e.hinge.w),e.o+e.hinge.margin+e.hinge.d/2,e.h+e.hinge.h] | 291 | corner2: [s*(hinges_apart+e.hinge.w),e.o+e.hinge.margin+e.hinge.d/2,e.h+e.hinge.h] |
290 | }).union(CSG.cylinder({ | 292 | }).union(CSG.cylinder({ |
291 | start: [s*hinges_apart,e.o,e.h+e.hinge.h], | 293 | start: [s*hinges_apart,e.o,e.h+e.hinge.h], |
292 | end: [s*(hinges_apart+e.hinge.w),e.o,e.h+e.hinge.h], | 294 | end: [s*(hinges_apart+e.hinge.w),e.o,e.h+e.hinge.h], |
293 | radius: e.hinge.d/2+e.hinge.margin | 295 | radius: e.hinge.d/2+e.hinge.margin |