-rw-r--r-- | delta.jscad | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/delta.jscad b/delta.jscad index ad19f88..eb538d2 100644 --- a/delta.jscad +++ b/delta.jscad | |||
@@ -1,741 +1,757 @@ | |||
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 | 10 | w: 20 |
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 | }, | 42 | }, |
42 | hotend: { | 43 | hotend: { |
43 | h: 62.4, // full assembly height | 44 | h: 62.4, // full assembly height |
44 | groove: { d:12, h:6 }, // grove diameter and height | 45 | groove: { d:12, h:6 }, // grove diameter and height |
45 | ungroove: { d:16, above:3.7, below: 3+4 } | 46 | ungroove: { d:16, above:3.7, below: 3+4 } |
46 | }, | 47 | }, |
47 | effector: { | 48 | effector: { |
48 | h: 6, | 49 | h: 6, |
49 | o: 20,// offset to the rod mounts line | 50 | o: 20,// offset to the rod mounts line |
50 | rods_apart: 40, | 51 | rods_apart: 40, |
51 | cone: { shell: 1, angle: Math.PI/6 }, | 52 | cone: { shell: 1, angle: Math.PI/6 }, |
52 | rodend: { | 53 | rodend: { |
53 | joint_w: 7,// thickness of the joint | 54 | joint_w: 7,// thickness of the joint |
54 | screw_l: 20-1, // 20 with the head | 55 | screw_l: 20-1, // 20 with the head |
55 | screw_d: 3 | 56 | screw_d: 3 |
56 | }, | 57 | }, |
57 | hotend: { margin: 2 }, | 58 | hotend: { margin: 2 }, |
58 | hinge: { | 59 | hinge: { |
59 | d: 3, w: 5, margin: 2.5, | 60 | d: 3, w: 5, margin: 2.5, |
60 | h: 1+(6+3.7)/2, // elevation + grove + top | 61 | h: 1+(6+3.7)/2, // elevation + grove + top |
61 | e: 1 // elevation | 62 | e: 1 // elevation |
62 | }, | 63 | }, |
63 | clamp: { | 64 | clamp: { |
64 | shell: 4.6, | 65 | shell: 4.6, |
65 | d: 3, | 66 | d: 3, |
66 | margin: 2.5, | 67 | margin: 2.5, |
67 | split: 0.6 | 68 | split: 0.6 |
68 | }, | 69 | }, |
69 | mswitch: { | 70 | mswitch: { |
70 | size: [ 19.8, 6, 10 ], | 71 | size: [ 19.8, 6, 10 ], |
71 | screw: { | 72 | screw: { |
72 | d: 2, h: 10/2-2, | 73 | d: 2, h: 10/2-2, |
73 | s: 1.3, // screw shell | 74 | s: 1.3, // screw shell |
74 | o: [-9.5/2,9.5/2].map(function(x) { | 75 | o: [-9.5/2,9.5/2].map(function(x) { |
75 | return -19.8/2+x; | 76 | return -19.8/2+x; |
76 | }) | 77 | }) |
77 | }, | 78 | }, |
78 | switch_x: 2.5 | 79 | switch_x: 2.5 |
79 | }, | 80 | }, |
80 | guide: { | 81 | guide: { |
81 | width: 3, height: 5+1, length: 6 | 82 | width: 3, height: 5+1, length: 6 |
82 | }, | 83 | }, |
83 | fanholder: { | 84 | fanholder: { |
84 | r: 30, | 85 | r: 30, |
85 | screw: { d: 3, m: 2.5/*margin*/ }, | 86 | screw: { d: 3, m: 2.5/*margin*/ }, |
86 | w: 3 | 87 | w: 3 |
87 | } | 88 | } |
88 | }, | 89 | }, |
89 | nut: { h: 2.3, w: 5.5 }, | 90 | nut: { h: 2.3, w: 5.5 }, |
90 | color: { | 91 | color: { |
91 | extrusion: [0.8, 0.8, 0.8, 0.8], | 92 | extrusion: [0.8, 0.8, 0.8, 0.8], |
92 | pcb: [ 0, 0.3, 0.2, 0.8 ], | 93 | pcb: [ 0, 0.3, 0.2, 0.8 ], |
93 | bulk: [ .9, .9, .9, .2 ], | 94 | bulk: [ .9, .9, .9, .2 ], |
94 | parts: [ 0, 0.8, 0, 0.9 ] | 95 | parts: [ 0, 0.8, 0, 0.9 ], |
96 | softparts: [ 0, 0, 0.8, 0.9 ] | ||
95 | } | 97 | } |
96 | }; | 98 | }; |
97 | 99 | ||
98 | var CD = { | 100 | var CD = { |
99 | base: (function(){ | 101 | base: (function(){ |
100 | var rv = {}; | 102 | var rv = {}; |
101 | rv.circumscription_r = | 103 | rv.circumscription_r = |
102 | CONFIG.base.sl/2/Math.cos(Math.PI/6); | 104 | CONFIG.base.sl/2/Math.cos(Math.PI/6); |
103 | rv.outer_inscription_r = | 105 | rv.outer_inscription_r = |
104 | Math.sqrt(Math.pow(rv.circumscription_r,2)- | 106 | Math.sqrt(Math.pow(rv.circumscription_r,2)- |
105 | Math.pow(CONFIG.base.sl/2,2)); | 107 | Math.pow(CONFIG.base.sl/2,2)); |
106 | rv.mid_inscription_r = | 108 | rv.mid_inscription_r = |
107 | rv.outer_inscription_r-CONFIG.extrusion.w/2; | 109 | rv.outer_inscription_r-CONFIG.extrusion.w/2; |
108 | rv.inner_inscription_r = | 110 | rv.inner_inscription_r = |
109 | rv.outer_inscription_r-CONFIG.extrusion.w/2; | 111 | rv.outer_inscription_r-CONFIG.extrusion.w/2; |
110 | // TODO: properly calculate | 112 | // TODO: properly calculate |
111 | rv.column_r = rv.circumscription_r - 48.29; | 113 | rv.column_r = rv.circumscription_r - 48.29; |
112 | return rv; | 114 | return rv; |
113 | })() | 115 | })() |
114 | }; | 116 | }; |
115 | 117 | ||
116 | var U = { | 118 | var U = { |
117 | hypotenuse: function(a,b) { | 119 | hypotenuse: function(a,b) { |
118 | return Math.sqrt(Math.pow(a,2)+Math.pow(b,2)); | 120 | return Math.sqrt(Math.pow(a,2)+Math.pow(b,2)); |
119 | }, | 121 | }, |
120 | peek: function(x,m) { | 122 | peek: function(x,m) { |
121 | console.log(x,m); | 123 | console.log(x,m); |
122 | return x; | 124 | return x; |
123 | } | 125 | } |
124 | }; | 126 | }; |
125 | 127 | ||
126 | /* {h:,w:} */ | 128 | /* {h:,w:} */ |
127 | function nut(o) { | 129 | function nut(o) { |
128 | var rv = CSG.cylinder({ | 130 | var rv = CSG.cylinder({ |
129 | start:[0,0,0],end:[0,0,o.h], | 131 | start:[0,0,0],end:[0,0,o.h], |
130 | radius: o.w/2/Math.cos(Math.PI/6), | 132 | radius: o.w/2/Math.cos(Math.PI/6), |
131 | resolution: 6 | 133 | resolution: 6 |
132 | }); | 134 | }); |
133 | rv.properties.axis_connector = new CSG.Connector([0,0,0],[0,0,1],[0,1,0]); | 135 | rv.properties.axis_connector = new CSG.Connector([0,0,0],[0,0,1],[0,1,0]); |
134 | return rv; | 136 | return rv; |
135 | } | 137 | } |
136 | 138 | ||
137 | var E3DV6 = { | 139 | var E3DV6 = { |
138 | dimensions: { | 140 | dimensions: { |
139 | big_d: 22.3, | 141 | big_d: 22.3, |
140 | 142 | ||
141 | }, | 143 | }, |
142 | heatsink: function() { | 144 | heatsink: function() { |
143 | var fn = 16; | 145 | var fn = 16; |
144 | var z=0; | 146 | var z=0; |
145 | var unite = [ {d:16,h:3.7},{d:12,h:6},{d:16,h:3} ].map(function(x) { | 147 | var unite = [ {d:16,h:3.7},{d:12,h:6},{d:16,h:3} ].map(function(x) { |
146 | return CSG.cylinder({ | 148 | return CSG.cylinder({ |
147 | start: [0,0,z], end: [0,0,z-=x.h], | 149 | start: [0,0,z], end: [0,0,z-=x.h], |
148 | radius: x.d/2, resolution: fn | 150 | radius: x.d/2, resolution: fn |
149 | }); | 151 | }); |
150 | }); | 152 | }); |
151 | unite.push(CSG.cylinder({ | 153 | unite.push(CSG.cylinder({ |
152 | start:[0,0,z-=1.5], end:[0,0,z-=1], | 154 | start:[0,0,z-=1.5], end:[0,0,z-=1], |
153 | radius: 16/2, resolution: fn | 155 | radius: 16/2, resolution: fn |
154 | })); | 156 | })); |
155 | for(var i=0;i<11;++i) unite.push(CSG.cylinder({ | 157 | for(var i=0;i<11;++i) unite.push(CSG.cylinder({ |
156 | start:[0,0,z-=1.5], end:[0,0,z-=1], | 158 | start:[0,0,z-=1.5], end:[0,0,z-=1], |
157 | radius: this.dimensions.big_d/2, resolution: fn | 159 | radius: this.dimensions.big_d/2, resolution: fn |
158 | })); | 160 | })); |
159 | unite.push(CSG.cylinder({ | 161 | unite.push(CSG.cylinder({ |
160 | start:[0,0,z], end: [0,0,-12.7], | 162 | start:[0,0,z], end: [0,0,-12.7], |
161 | radiusStart: 10/2, radiusEnd: 8.5/2, /* pretty arbitrary */ | 163 | radiusStart: 10/2, radiusEnd: 8.5/2, /* pretty arbitrary */ |
162 | resolution: fn | 164 | resolution: fn |
163 | })); | 165 | })); |
164 | var rv = union(unite); | 166 | var rv = union(unite); |
165 | rv = rv.subtract([CSG.cylinder({ | 167 | rv = rv.subtract([CSG.cylinder({ |
166 | start:[0,0,1], end: [0,0,z-1], | 168 | start:[0,0,1], end: [0,0,z-1], |
167 | radius: 4.2/2, resolution: fn | 169 | radius: 4.2/2, resolution: fn |
168 | }),CSG.cylinder({ | 170 | }),CSG.cylinder({ |
169 | start:[0,0,1], end: [0,0,-6.7/*somewhat arbitrary*/], | 171 | start:[0,0,1], end: [0,0,-6.7/*somewhat arbitrary*/], |
170 | radius: 8/2, resolution: fn | 172 | radius: 8/2, resolution: fn |
171 | }),CSG.cylinder({ | 173 | }),CSG.cylinder({ |
172 | start:[0,0,z-1], end: [0,0,z+14.8], | 174 | start:[0,0,z-1], end: [0,0,z+14.8], |
173 | radius: 6/2 /*M7*/, resolution: fn | 175 | radius: 6/2 /*M7*/, resolution: fn |
174 | })]); | 176 | })]); |
175 | rv.properties.pushfit_connector = new CSG.Connector([0,0,0],[0,0,-1],[1,0,0]); | 177 | rv.properties.pushfit_connector = new CSG.Connector([0,0,0],[0,0,-1],[1,0,0]); |
176 | rv.properties.heatbreak_connector = new CSG.Connector([0,0,z+14.8],[0,0,-1],[1,0,0]); | 178 | rv.properties.heatbreak_connector = new CSG.Connector([0,0,z+14.8],[0,0,-1],[1,0,0]); |
177 | rv.properties.grove_connector = new CSG.Connector([0,0,-3.7-3],[0,0,1],[1,0,0]); | 179 | rv.properties.grove_connector = new CSG.Connector([0,0,-3.7-3],[0,0,1],[1,0,0]); |
178 | return rv.setColor([0.8,0.8,0.8,0.9]); | 180 | return rv.setColor([0.8,0.8,0.8,0.9]); |
179 | } | 181 | } |
180 | }; | 182 | }; |
181 | 183 | ||
182 | var EFFECTOR = { | 184 | var EFFECTOR = { |
183 | /* {sd: screw diameter, l: cone length, s: screw shell, a: angle from axis} */ | 185 | /* {sd: screw diameter, l: cone length, s: screw shell, a: angle from axis} */ |
184 | cone: function effector_cone(o) { | 186 | cone: function effector_cone(o) { |
185 | var re = o.sd/2+o.s, rs = re+o.l*Math.tan(o.a||(Math.PI/4)); | 187 | var re = o.sd/2+o.s, rs = re+o.l*Math.tan(o.a||(Math.PI/4)); |
186 | var rv = CSG.cylinder({ | 188 | var rv = CSG.cylinder({ |
187 | start: [0,0,0], end: [0,0,o.l], | 189 | start: [0,0,0], end: [0,0,o.l], |
188 | radiusStart: rs, radiusEnd: re, | 190 | radiusStart: rs, radiusEnd: re, |
189 | resolution: Math.floor(rs*2*2) | 191 | resolution: Math.floor(rs*2*2) |
190 | }).subtract(CSG.cylinder({ | 192 | }).subtract(CSG.cylinder({ |
191 | start:[0,0,-1], end:[0,0,o.l+1], radius: o.sd, | 193 | start:[0,0,-1], end:[0,0,o.l+1], radius: o.sd, |
192 | //resolution: Math.floor(o.sd*2*2) | 194 | //resolution: Math.floor(o.sd*2*2) |
193 | })); | 195 | })); |
194 | rv.properties.top_connector = new CSG.Connector([0,0,o.l],[0,0,-1],[1,0,0]); | 196 | rv.properties.top_connector = new CSG.Connector([0,0,o.l],[0,0,-1],[1,0,0]); |
195 | rv.properties.bottom_connector = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); | 197 | rv.properties.bottom_connector = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); |
196 | var nuthole = nut(CONFIG.nut); | 198 | var nuthole = nut(CONFIG.nut); |
197 | rv = rv.subtract(nuthole.connectTo( | 199 | rv = rv.subtract(nuthole.connectTo( |
198 | nuthole.properties.axis_connector, rv.properties.bottom_connector, | 200 | nuthole.properties.axis_connector, rv.properties.bottom_connector, |
199 | false, 0 | 201 | false, 0 |
200 | )); | 202 | )); |
201 | return rv.intersect(CSG.cylinder({start:[0,0,0],end:[0,0,o.l],radius:6/*TODO:calculate*/})); | 203 | return rv.intersect(CSG.cylinder({start:[0,0,0],end:[0,0,o.l],radius:6/*TODO:calculate*/})); |
202 | }, | 204 | }, |
203 | platform_bb: function platform_bb() { | 205 | platform_bb: function platform_bb() { |
204 | var e = CONFIG.effector; | 206 | var e = CONFIG.effector; |
205 | var r = U.hypotenuse(e.rods_apart/2,e.o+e.rodend.screw_d/2+e.cone.shell); | 207 | var r = U.hypotenuse(e.rods_apart/2,e.o+e.rodend.screw_d/2+e.cone.shell); |
206 | var rv = CSG.sphere({ | 208 | var rv = CSG.sphere({ |
207 | center: [0,0,e.h/2], radius: r, | 209 | center: [0,0,e.h/2], radius: r, |
208 | resolution: r*2*2 | 210 | resolution: r*2*2 |
209 | }).intersect(CSG.cube({ | 211 | }).intersect(CSG.cube({ |
210 | corner1: [-r,-r,0], corner2: [r,r,e.h] | 212 | corner1: [-r,-r,0], corner2: [r,r,e.h] |
211 | })); | 213 | })); |
212 | rv.properties.base_connector = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); | 214 | rv.properties.base_connector = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); |
213 | return rv; | 215 | return rv; |
214 | }, | 216 | }, |
215 | effector: function effector_effector() { | 217 | effector: function effector_effector() { |
216 | var e = CONFIG.effector; | 218 | var e = CONFIG.effector; |
217 | var conel = e.rodend.screw_l-e.rodend.joint_w; | 219 | var conel = e.rodend.screw_l-e.rodend.joint_w; |
218 | var nutr = CONFIG.nut.w/2/Math.cos(Math.PI/6); | 220 | var nutr = CONFIG.nut.w/2/Math.cos(Math.PI/6); |
219 | var cone = this.cone({sd:e.rodend.screw_d/2,l:conel,s:e.cone.shell,a:e.cone.angle}); | 221 | var cone = this.cone({sd:e.rodend.screw_d/2,l:conel,s:e.cone.shell,a:e.cone.angle}); |
220 | var rcorner = U.hypotenuse(e.o-e.rodend.screw_d/2-e.cone.shell,e.rods_apart/2)-3.85; //XXX:config/calc | 222 | var rcorner = U.hypotenuse(e.o-e.rodend.screw_d/2-e.cone.shell,e.rods_apart/2)-3.85; //XXX:config/calc |
221 | var ropen = E3DV6.dimensions.big_d/2+e.hotend.margin; | 223 | var ropen = E3DV6.dimensions.big_d/2+e.hotend.margin; |
222 | var rmount = this.rmount = (rcorner+ropen)/2; | 224 | var rmount = this.rmount = (rcorner+ropen)/2; |
223 | var rv = []; | 225 | var rv = []; |
224 | for(var a=0;a<360;a+=120) { | 226 | for(var a=0;a<360;a+=120) { |
225 | rv.push(union([-1,1].map(function(s) { | 227 | rv.push(union([-1,1].map(function(s) { |
226 | return cone.connectTo(cone.properties.top_connector, | 228 | return cone.connectTo(cone.properties.top_connector, |
227 | new CSG.Connector([s*e.rods_apart/2,e.o,e.h/2],[-s,0,0],[0,0,1]), | 229 | new CSG.Connector([s*e.rods_apart/2,e.o,e.h/2],[-s,0,0],[0,0,1]), |
228 | false, 0); | 230 | false, 0); |
229 | })).union(CSG.cube({ | 231 | })).union(CSG.cube({ |
230 | corner1:[e.rods_apart/2-conel+.1,e.o-nutr,0], | 232 | corner1:[e.rods_apart/2-conel+.1,e.o-nutr,0], |
231 | corner2:[-e.rods_apart/2+conel-.1, | 233 | corner2:[-e.rods_apart/2+conel-.1, |
232 | -rcorner, | 234 | -rcorner, |
233 | e.h] | 235 | e.h] |
234 | })).rotateZ(a)); | 236 | })).rotateZ(a)); |
235 | } | 237 | } |
236 | rv.push(CSG.cylinder({ | 238 | rv.push(CSG.cylinder({ |
237 | start:[0,0,0], end:[0,0,e.h], | 239 | start:[0,0,0], end:[0,0,e.h], |
238 | radius: U.hypotenuse(e.o-nutr,e.rods_apart/2-conel) | 240 | radius: U.hypotenuse(e.o-nutr,e.rods_apart/2-conel) |
239 | })); | 241 | })); |
240 | rv = union(rv).intersect(this.platform_bb()).subtract(CSG.cylinder({ | 242 | rv = union(rv).intersect(this.platform_bb()).subtract(CSG.cylinder({ |
241 | start:[0,0,-1], end:[0,0,e.h+1], | 243 | start:[0,0,-1], end:[0,0,e.h+1], |
242 | radius: ropen, resolution: ropen*4 | 244 | radius: ropen, resolution: ropen*4 |
243 | })).subtract([/*0, probe here*/120,240].map(function(x) { /* nut pockets */ | 245 | })).subtract([/*0, probe here*/120,240].map(function(x) { /* nut pockets */ |
244 | return CSG.cube({ | 246 | return CSG.cube({ |
245 | corner1:[-CONFIG.nut.w/2,0,(e.h-CONFIG.nut.h)/2], | 247 | corner1:[-CONFIG.nut.w/2,0,(e.h-CONFIG.nut.h)/2], |
246 | corner2:[CONFIG.nut.w/2,-rcorner-1,(e.h+CONFIG.nut.h)/2] | 248 | corner2:[CONFIG.nut.w/2,-rcorner-1,(e.h+CONFIG.nut.h)/2] |
247 | }).union(CSG.cylinder({ | 249 | }).union(CSG.cylinder({ |
248 | start:[0,-rmount,-1], end:[0,-rmount,e.h+1], | 250 | start:[0,-rmount,-1], end:[0,-rmount,e.h+1], |
249 | radius: 3/2 // XXX: | 251 | radius: 3/2 // XXX: |
250 | })).subtract(CSG.cylinder({ | 252 | })).subtract(CSG.cylinder({ |
251 | start:[0,-rmount,(e.h+CONFIG.nut.h)/2], | 253 | start:[0,-rmount,(e.h+CONFIG.nut.h)/2], |
252 | end:[0,-rmount,(e.h+CONFIG.nut.h)/2+PRINT.layer_height*3/2], | 254 | end:[0,-rmount,(e.h+CONFIG.nut.h)/2+PRINT.layer_height*3/2], |
253 | radius: 3/2+.1 | 255 | radius: 3/2+.1 |
254 | })).rotateZ(x); | 256 | })).rotateZ(x); |
255 | })).subtract( CSG.cylinder({ // pulldown screw | 257 | })).subtract( CSG.cylinder({ // pulldown screw |
256 | start: [0,-rcorner+e.mswitch.size[1]+PRINT.extrusion_width+3/2/*XXX:conf*/,-1], | 258 | start: [0,-rcorner+e.mswitch.size[1]+PRINT.extrusion_width+3/2/*XXX:conf*/,-1], |
257 | end: [0,-rcorner+e.mswitch.size[1]+PRINT.extrusion_width+3/2/*XXX:conf*/,e.h+1], | 259 | end: [0,-rcorner+e.mswitch.size[1]+PRINT.extrusion_width+3/2/*XXX:conf*/,e.h+1], |
258 | radius: 3/2+1 /*XXX: config */ | 260 | radius: 3/2+1 /*XXX: config */ |
259 | })).subtract( CSG.cylinder({ /* switch-screw */ | 261 | })).subtract( CSG.cylinder({ /* switch-screw */ |
260 | start: [e.mswitch.switch_x,-rcorner+e.mswitch.size[1]/2,-1], | 262 | start: [e.mswitch.switch_x,-rcorner+e.mswitch.size[1]/2,-1], |
261 | end: [e.mswitch.switch_x,-rcorner+e.mswitch.size[1]/2,e.h+1], | 263 | end: [e.mswitch.switch_x,-rcorner+e.mswitch.size[1]/2,e.h+1], |
262 | radius: e.mswitch.screw.d/2 | 264 | radius: e.mswitch.screw.d/2 |
263 | })); | 265 | })); |
264 | // add hinges | 266 | // add hinges |
265 | rv.properties.hinge_connector=new CSG.Properties(); | 267 | rv.properties.hinge_connector=new CSG.Properties(); |
266 | var hinges_apart=e.rods_apart/2-conel; | 268 | var hinges_apart=e.rods_apart/2-conel; |
267 | rv = rv.union([-1,1].map(function hinge(s) { | 269 | rv = rv.union([-1,1].map(function hinge(s) { |
268 | rv.properties.hinge_connector[s]=new CSG.Connector([s*hinges_apart,e.o,e.h+e.hinge.h],[s,0,0],[0,0,1]); | 270 | rv.properties.hinge_connector[s]=new CSG.Connector([s*hinges_apart,e.o,e.h+e.hinge.h],[s,0,0],[0,0,1]); |
269 | return CSG.cube({ | 271 | return CSG.cube({ |
270 | corner1: [s*hinges_apart,e.o-e.hinge.margin-e.hinge.d/2,e.h], | 272 | corner1: [s*hinges_apart,e.o-e.hinge.margin-e.hinge.d/2,e.h], |
271 | corner2: [s*(hinges_apart+e.hinge.w),e.o+e.hinge.margin+e.hinge.d/2,e.h+e.hinge.h] | 273 | corner2: [s*(hinges_apart+e.hinge.w),e.o+e.hinge.margin+e.hinge.d/2,e.h+e.hinge.h] |
272 | }).union(CSG.cylinder({ | 274 | }).union(CSG.cylinder({ |
273 | start: [s*hinges_apart,e.o,e.h+e.hinge.h], | 275 | start: [s*hinges_apart,e.o,e.h+e.hinge.h], |
274 | end: [s*(hinges_apart+e.hinge.w),e.o,e.h+e.hinge.h], | 276 | end: [s*(hinges_apart+e.hinge.w),e.o,e.h+e.hinge.h], |
275 | radius: e.hinge.d/2+e.hinge.margin | 277 | radius: e.hinge.d/2+e.hinge.margin |
276 | })).subtract(CSG.cylinder({ | 278 | })).subtract(CSG.cylinder({ |
277 | start: [s*(hinges_apart-1),e.o,e.h+e.hinge.h], | 279 | start: [s*(hinges_apart-1),e.o,e.h+e.hinge.h], |
278 | end: [s*(hinges_apart+e.hinge.w+1),e.o,e.h+e.hinge.h], | 280 | end: [s*(hinges_apart+e.hinge.w+1),e.o,e.h+e.hinge.h], |
279 | radius: e.hinge.d/2 | 281 | radius: e.hinge.d/2 |
280 | })); | 282 | })); |
281 | })); | 283 | })); |
282 | // add clamp guides | 284 | // add clamp guides |
283 | var cgrr = e.guide.width/3; | 285 | var cgrr = e.guide.width/3; |
284 | rv = rv.union([-1,1].map(function guide(s) { | 286 | rv = rv.union([-1,1].map(function guide(s) { |
285 | return CSG.roundedCube({ | 287 | return CSG.roundedCube({ |
286 | center: [s*(e.mswitch.size[0]+PRINT.slide_tolerance+e.guide.width)/2,-rcorner+e.guide.length/2,e.h+e.guide.height/2-cgrr], | 288 | center: [s*(e.mswitch.size[0]+PRINT.slide_tolerance+e.guide.width)/2,-rcorner+e.guide.length/2,e.h+e.guide.height/2-cgrr], |
287 | radius: [e.guide.width/2,e.guide.length/2,e.guide.height/2+cgrr], | 289 | radius: [e.guide.width/2,e.guide.length/2,e.guide.height/2+cgrr], |
288 | roundradius: cgrr | 290 | roundradius: cgrr |
289 | }).intersect(CSG.cube({ | 291 | }).intersect(CSG.cube({ |
290 | center: [s*(e.mswitch.size[0]+PRINT.slide_tolerance+e.guide.width)/2,-rcorner+e.guide.length/2,e.h+e.guide.height/2], | 292 | center: [s*(e.mswitch.size[0]+PRINT.slide_tolerance+e.guide.width)/2,-rcorner+e.guide.length/2,e.h+e.guide.height/2], |
291 | radius: [e.guide.width/2,e.guide.length/2,e.guide.height/2+.1], | 293 | radius: [e.guide.width/2,e.guide.length/2,e.guide.height/2+.1], |
292 | roundradius: cgrr | 294 | roundradius: cgrr |
293 | })); | 295 | })); |
294 | })); | 296 | })); |
295 | rv.properties.grove_connector = new CSG.Connector([0,0,e.h+e.hinge.e+6/2],[0,0,1],[1,0,0]); | 297 | rv.properties.grove_connector = new CSG.Connector([0,0,e.h+e.hinge.e+6/2],[0,0,1],[1,0,0]); |
296 | rv.properties.rcorner = rcorner; | 298 | rv.properties.rcorner = rcorner; |
297 | return rv.setColor([0.4,0.8,0.4,0.9]); | 299 | return rv.setColor([0.4,0.8,0.4,0.9]); |
298 | }, | 300 | }, |
299 | hinged: function effector_hinged(o) { | 301 | hinged: function effector_hinged(o) { |
300 | var e = CONFIG.effector; | 302 | var e = CONFIG.effector; |
301 | var conel = e.rodend.screw_l-e.rodend.joint_w; | 303 | var conel = e.rodend.screw_l-e.rodend.joint_w; |
302 | var hinges_apart = e.rods_apart/2-conel; | 304 | var hinges_apart = e.rods_apart/2-conel; |
303 | var hhr = e.o-e.hinge.d/2-e.hinge.margin; // hotend holder radius | 305 | var hhr = e.o-e.hinge.d/2-e.hinge.margin; // hotend holder radius |
304 | var hhh = CONFIG.hotend.groove.h+CONFIG.hotend.ungroove.above; | 306 | var hhh = CONFIG.hotend.groove.h+CONFIG.hotend.ungroove.above; |
305 | var rv = CSG.cylinder({ /* hinge */ | 307 | var rv = CSG.cylinder({ /* hinge */ |
306 | start: [-hinges_apart+PRINT.slide_tolerance,e.o,e.h+e.hinge.h], | 308 | start: [-hinges_apart+PRINT.slide_tolerance,e.o,e.h+e.hinge.h], |
307 | end: [hinges_apart-PRINT.slide_tolerance,e.o,e.h+e.hinge.h], | 309 | end: [hinges_apart-PRINT.slide_tolerance,e.o,e.h+e.hinge.h], |
308 | radius: e.hinge.d/2+e.hinge.margin | 310 | radius: e.hinge.d/2+e.hinge.margin |
309 | }).union( /* lower hotend holder */ | 311 | }).union( /* lower hotend holder */ |
310 | CSG.cylinder({ | 312 | CSG.cylinder({ |
311 | start: [0,0,e.h+e.hinge.e], end: [0,0,e.h+e.hinge.e+CONFIG.hotend.groove.h], | 313 | start: [0,0,e.h+e.hinge.e], end: [0,0,e.h+e.hinge.e+CONFIG.hotend.groove.h], |
312 | radius: hhr | 314 | radius: hhr |
313 | }).subtract(CSG.cylinder({ | 315 | }).subtract(CSG.cylinder({ |
314 | start: [0,0,e.h+e.hinge.e-1], end: [0,0,e.h+e.hinge.e+CONFIG.hotend.groove.h+1], | 316 | start: [0,0,e.h+e.hinge.e-1], end: [0,0,e.h+e.hinge.e+CONFIG.hotend.groove.h+1], |
315 | radius: CONFIG.hotend.groove.d/2 +PRINT.fit_tolerance | 317 | radius: CONFIG.hotend.groove.d/2 +PRINT.fit_tolerance |
316 | })) | 318 | })) |
317 | ).union( /* upper hotend holder */ | 319 | ).union( /* upper hotend holder */ |
318 | CSG.cylinder({ | 320 | CSG.cylinder({ |
319 | start: [0,0,e.h+e.hinge.e+CONFIG.hotend.groove.h], | 321 | start: [0,0,e.h+e.hinge.e+CONFIG.hotend.groove.h], |
320 | end: [0,0,e.h+e.hinge.e+CONFIG.hotend.groove.h+CONFIG.hotend.ungroove.above], | 322 | end: [0,0,e.h+e.hinge.e+CONFIG.hotend.groove.h+CONFIG.hotend.ungroove.above], |
321 | radius: hhr | 323 | radius: hhr |
322 | }).subtract(CSG.cylinder({ | 324 | }).subtract(CSG.cylinder({ |
323 | start: [0,0,e.h+e.hinge.e+CONFIG.hotend.groove.h-1], | 325 | start: [0,0,e.h+e.hinge.e+CONFIG.hotend.groove.h-1], |
324 | end: [0,0,e.h+e.hinge.e+CONFIG.hotend.groove.h+CONFIG.hotend.ungroove.above+1], | 326 | end: [0,0,e.h+e.hinge.e+CONFIG.hotend.groove.h+CONFIG.hotend.ungroove.above+1], |
325 | radius: CONFIG.hotend.ungroove.d/2 +PRINT.fit_tolerance | 327 | radius: CONFIG.hotend.ungroove.d/2 +PRINT.fit_tolerance |
326 | })) | 328 | })) |
327 | ).union( /* connect mount with hinge */ | 329 | ).union( /* connect mount with hinge */ |
328 | CSG.cube({ | 330 | CSG.cube({ |
329 | corner1: [-hinges_apart+PRINT.slide_tolerance,CONFIG.hotend.ungroove.d/2+PRINT.fit_tolerance,e.h+e.hinge.e], | 331 | corner1: [-hinges_apart+PRINT.slide_tolerance,CONFIG.hotend.ungroove.d/2+PRINT.fit_tolerance,e.h+e.hinge.e], |
330 | corner2: [hinges_apart-PRINT.slide_tolerance,e.o,e.h+e.hinge.h+e.hinge.d/2+e.hinge.margin] | 332 | corner2: [hinges_apart-PRINT.slide_tolerance,e.o,e.h+e.hinge.h+e.hinge.d/2+e.hinge.margin] |
331 | }) | 333 | }) |
332 | ).subtract( /* hinge screwhole */ | 334 | ).subtract( /* hinge screwhole */ |
333 | CSG.cylinder({ | 335 | CSG.cylinder({ |
334 | start: [-hinges_apart-1,e.o,e.h+e.hinge.h], | 336 | start: [-hinges_apart-1,e.o,e.h+e.hinge.h], |
335 | end: [hinges_apart+1,e.o,e.h+e.hinge.h], | 337 | end: [hinges_apart+1,e.o,e.h+e.hinge.h], |
336 | radius: e.hinge.d/2 | 338 | radius: e.hinge.d/2 |
337 | }) | 339 | }) |
338 | ).union( /* hold clamp together */ | 340 | ).union( /* hold clamp together */ |
339 | [-1,1].map(function(s) { | 341 | [-1,1].map(function(s) { |
340 | return CSG.roundedCube({ | 342 | return CSG.roundedCube({ |
341 | corner1: [s*(-hhr-e.clamp.margin*2-e.clamp.d),-e.clamp.shell,e.h+e.hinge.e], | 343 | corner1: [s*(-hhr-e.clamp.margin*2-e.clamp.d),-e.clamp.shell,e.h+e.hinge.e], |
342 | corner2: [s*(-CONFIG.hotend.ungroove.d/2-PRINT.fit_tolerance),+e.clamp.shell,e.h+e.hinge.e+hhh], | 344 | corner2: [s*(-CONFIG.hotend.ungroove.d/2-PRINT.fit_tolerance),+e.clamp.shell,e.h+e.hinge.e+hhh], |
343 | roundradius: 1.5 | 345 | roundradius: 1.5 |
344 | }); | 346 | }); |
345 | }) | 347 | }) |
346 | ).subtract( /* screws for holding clamp */ | 348 | ).subtract( /* screws for holding clamp */ |
347 | [-1,1].map(function(s) { | 349 | [-1,1].map(function(s) { |
348 | var nuthole = nut(CONFIG.nut); | 350 | var nuthole = nut(CONFIG.nut); |
349 | var x = s*(-hhr-e.clamp.margin-e.clamp.d/2); | 351 | var x = s*(-hhr-e.clamp.margin-e.clamp.d/2); |
350 | return CSG.cylinder({ | 352 | return CSG.cylinder({ |
351 | start: [x,-e.clamp.shell-1,e.h+e.hinge.e+hhh/2], | 353 | start: [x,-e.clamp.shell-1,e.h+e.hinge.e+hhh/2], |
352 | end: [x,e.clamp.shell+1,e.h+e.hinge.e+hhh/2], | 354 | end: [x,e.clamp.shell+1,e.h+e.hinge.e+hhh/2], |
353 | radius: e.clamp.d/2 | 355 | radius: e.clamp.d/2 |
354 | }).union(nuthole.connectTo( | 356 | }).union(nuthole.connectTo( |
355 | nuthole.properties.axis_connector, | 357 | nuthole.properties.axis_connector, |
356 | new CSG.Connector([x,e.clamp.shell,e.h+e.hinge.e+hhh/2],[0,-1,0],[0,0,1]), | 358 | new CSG.Connector([x,e.clamp.shell,e.h+e.hinge.e+hhh/2],[0,-1,0],[0,0,1]), |
357 | false, 0 | 359 | false, 0 |
358 | )).union(CSG.cylinder({ | 360 | )).union(CSG.cylinder({ |
359 | start: [x,-e.clamp.shell-1,e.h+e.hinge.e+hhh/2], | 361 | start: [x,-e.clamp.shell-1,e.h+e.hinge.e+hhh/2], |
360 | end: [x,0,e.h+e.hinge.e+hhh/2], | 362 | end: [x,0,e.h+e.hinge.e+hhh/2], |
361 | radius: e.clamp.d/2+PRINT.slide_tolerance | 363 | radius: e.clamp.d/2+PRINT.slide_tolerance |
362 | })); | 364 | })); |
363 | }) | 365 | }) |
364 | ); | 366 | ); |
365 | var ms = o.microswitch; | 367 | var ms = o.microswitch; |
366 | var msedge = o.effector.properties.rcorner; | 368 | var msedge = o.effector.properties.rcorner; |
367 | var msh = 9.5; // microswitch holes apart | 369 | var msh = 9.5; // microswitch holes apart |
368 | var mshh = Math.abs(ms.properties.switch_connector.point.z-ms.properties.screw_connector[0].point.z); // microswitch holes height | 370 | var mshh = Math.abs(ms.properties.switch_connector.point.z-ms.properties.screw_connector[0].point.z); // microswitch holes height |
369 | rv = rv.union(CSG.cube({ // connect clamp with microswitch | 371 | rv = rv.union(CSG.cube({ // connect clamp with microswitch |
370 | corner1: [-ms.properties.microswitch.size.x/2,-msedge+.1,e.h+e.hinge.e], | 372 | corner1: [-ms.properties.microswitch.size.x/2,-msedge+.1,e.h+e.hinge.e], |
371 | corner2: [+ms.properties.microswitch.size.x/2,-CONFIG.hotend.ungroove.d/2-PRINT.fit_tolerance,e.h+e.hinge.e+hhh] | 373 | corner2: [+ms.properties.microswitch.size.x/2,-CONFIG.hotend.ungroove.d/2-PRINT.fit_tolerance,e.h+e.hinge.e+hhh] |
372 | })).union([-msh/2,msh/2].map(function(x) { // shell for microswitch screws | 374 | })).union([-msh/2,msh/2].map(function(x) { // shell for microswitch screws |
373 | return CSG.roundedCylinder({ | 375 | return CSG.roundedCylinder({ |
374 | start: [x,-CONFIG.hotend.ungroove.d/2-PRINT.fit_tolerance-(e.mswitch.screw.d/2+e.mswitch.screw.s),e.h+e.hinge.e+mshh], | 376 | start: [x,-CONFIG.hotend.ungroove.d/2-PRINT.fit_tolerance-(e.mswitch.screw.d/2+e.mswitch.screw.s),e.h+e.hinge.e+mshh], |
375 | end: [x,-msedge+ms.properties.microswitch.size.y,e.h+e.hinge.e+mshh], | 377 | end: [x,-msedge+ms.properties.microswitch.size.y,e.h+e.hinge.e+mshh], |
376 | radius: e.mswitch.screw.d/2+e.mswitch.screw.s | 378 | radius: e.mswitch.screw.d/2+e.mswitch.screw.s |
377 | }); | 379 | }); |
378 | })).subtract(CSG.cube({ // cut off excess if any | 380 | })).subtract(CSG.cube({ // cut off excess if any |
379 | corner1:[-hhr,-msedge+ms.properties.microswitch.size.y,e.h+e.hinge.e-1], | 381 | corner1:[-hhr,-msedge+ms.properties.microswitch.size.y,e.h+e.hinge.e-1], |
380 | corner2:[hhr,-msedge-1,e.h+e.hinge.e+hhh+e.mswitch.screw.d+e.mswitch.screw.s+1] | 382 | corner2:[hhr,-msedge-1,e.h+e.hinge.e+hhh+e.mswitch.screw.d+e.mswitch.screw.s+1] |
381 | })).subtract([-msh/2,msh/2].map(function(x) { return CSG.roundedCylinder({ // screwholes | 383 | })).subtract([-msh/2,msh/2].map(function(x) { return CSG.roundedCylinder({ // screwholes |
382 | start: [x,-CONFIG.hotend.ungroove.d/2-PRINT.fit_tolerance-(e.mswitch.screw.d/2+e.mswitch.screw.s),e.h+e.hinge.e+mshh], | 384 | start: [x,-CONFIG.hotend.ungroove.d/2-PRINT.fit_tolerance-(e.mswitch.screw.d/2+e.mswitch.screw.s),e.h+e.hinge.e+mshh], |
383 | end: [x,-msedge+ms.properties.microswitch.size.y,e.h+e.hinge.e+mshh], | 385 | end: [x,-msedge+ms.properties.microswitch.size.y,e.h+e.hinge.e+mshh], |
384 | radius: e.mswitch.screw.d/2 | 386 | radius: e.mswitch.screw.d/2 |
385 | })})).subtract(CSG.cylinder({ // pulldown screw | 387 | })})).subtract(CSG.cylinder({ // pulldown screw |
386 | start:[0,-msedge+ms.properties.microswitch.size.y+3/2/*XXX:config*/+PRINT.extrusion_width,e.h+e.hinge.e-1], | 388 | start:[0,-msedge+ms.properties.microswitch.size.y+3/2/*XXX:config*/+PRINT.extrusion_width,e.h+e.hinge.e-1], |
387 | end:[0,-msedge+ms.properties.microswitch.size.y+3/2/*XXX:config*/+PRINT.extrusion_width,e.h+e.hinge.e+hhh+1], | 389 | end:[0,-msedge+ms.properties.microswitch.size.y+3/2/*XXX:config*/+PRINT.extrusion_width,e.h+e.hinge.e+hhh+1], |
388 | radius: 3/2/*XXX:config*/ | 390 | radius: 3/2/*XXX:config*/ |
389 | })); | 391 | })); |
390 | rv.properties.microswitch_screw_connector = new CSG.Properties(); | 392 | rv.properties.microswitch_screw_connector = new CSG.Properties(); |
391 | [-msh/2,msh/2].forEach(function(x,i) { | 393 | [-msh/2,msh/2].forEach(function(x,i) { |
392 | rv.properties.microswitch_screw_connector[i] = new CSG.Connector( | 394 | rv.properties.microswitch_screw_connector[i] = new CSG.Connector( |
393 | [x,-msedge,e.h+e.hinge.e+mshh], | 395 | [x,-msedge,e.h+e.hinge.e+mshh], |
394 | [0,1,0], [0,0,-1] | 396 | [0,1,0], [0,0,-1] |
395 | ); | 397 | ); |
396 | }); | 398 | }); |
397 | return rv.setColor([0.3,0.8,0.3,0.9]); | 399 | return rv.setColor([0.3,0.8,0.3,0.9]); |
398 | }, | 400 | }, |
399 | split_hinged: function effector_split_hinged(hinged) { | 401 | split_hinged: function effector_split_hinged(hinged) { |
400 | var e = CONFIG.effector; | 402 | var e = CONFIG.effector; |
401 | var b = hinged.getBounds(); | 403 | var b = hinged.getBounds(); |
402 | var ymax = Math.max(Math.abs(b[0].y),Math.abs(b[1].y)); | 404 | var ymax = Math.max(Math.abs(b[0].y),Math.abs(b[1].y)); |
403 | var zmax = Math.max(b[0].z,b[1].z); | 405 | var zmax = Math.max(b[0].z,b[1].z); |
404 | return [-1,1].map(function(s) { | 406 | return [-1,1].map(function(s) { |
405 | return hinged.intersect(CSG.cube({ | 407 | return hinged.intersect(CSG.cube({ |
406 | corner1: [Math.min(b[0].x,b[1].x)-1,s*e.clamp.split/2,-zmax-1], | 408 | corner1: [Math.min(b[0].x,b[1].x)-1,s*e.clamp.split/2,-zmax-1], |
407 | corner2: [Math.max(b[0].x,b[1].x)+1,s*(ymax+1),zmax+1] | 409 | corner2: [Math.max(b[0].x,b[1].x)+1,s*(ymax+1),zmax+1] |
408 | })); | 410 | })); |
409 | }); | 411 | }); |
410 | }, | 412 | }, |
411 | fanholder: function effector_fanholder() { | 413 | fanholder: function effector_fanholder() { |
412 | var fh = CONFIG.effector.fanholder; | 414 | var fh = CONFIG.effector.fanholder; |
413 | var od = fh.screw.d+2*fh.screw.m; | 415 | var od = fh.screw.d+2*fh.screw.m; |
414 | return linear_extrude({height:fh.w},hull( | 416 | return linear_extrude({height:fh.w},hull( |
415 | CAG.circle({center:[0,-this.rmount],radius:od/2}), | 417 | CAG.circle({center:[0,-this.rmount],radius:od/2}), |
416 | CAG.circle({center:[0,-fh.r+od/2+fh.w/2],radius:fh.w/2}) | 418 | CAG.circle({center:[0,-fh.r+od/2+fh.w/2],radius:fh.w/2}) |
417 | )).translate([0,0,-fh.w]).union( | 419 | )).translate([0,0,-fh.w]).union( |
418 | linear_extrude({height:fh.w},hull( | 420 | linear_extrude({height:fh.w},hull( |
419 | CAG.circle({center:[fh.w/2,-this.rmount-od/2-fh.w/2],radius:fh.w/2}), | 421 | CAG.circle({center:[fh.w/2,-this.rmount-od/2-fh.w/2],radius:fh.w/2}), |
420 | CAG.circle({center:[od/2,-fh.r],radius:od/2}) | 422 | CAG.circle({center:[od/2,-fh.r],radius:od/2}) |
421 | )).rotateY(90).translate([-fh.w/2,0,0]) | 423 | )).rotateY(90).translate([-fh.w/2,0,0]) |
422 | ).subtract( CSG.cylinder({ | 424 | ).subtract( CSG.cylinder({ |
423 | start: [-fh.w,-fh.r,-od/2], | 425 | start: [-fh.w,-fh.r,-od/2], |
424 | end: [fh.w,-fh.r,-od/2], | 426 | end: [fh.w,-fh.r,-od/2], |
425 | radius: fh.screw.d/2 | 427 | radius: fh.screw.d/2 |
426 | })).subtract( CSG.cylinder({ | 428 | })).subtract( CSG.cylinder({ |
427 | start: [0,-this.rmount,1], | 429 | start: [0,-this.rmount,1], |
428 | end: [0,-this.rmount,-fh.w-1], | 430 | end: [0,-this.rmount,-fh.w-1], |
429 | radius: fh.screw.d/2 | 431 | radius: fh.screw.d/2 |
430 | })).setColor([0.3,0.8,0.3,0.9]).rotateZ(-120); | 432 | })).setColor([0.3,0.8,0.3,0.9]).rotateZ(-120); |
431 | } | 433 | } |
432 | }; | 434 | }; |
433 | 435 | ||
434 | function columns() { | 436 | function columns() { |
435 | var rv = [0,1,2].map(function(x) { | 437 | var rv = [0,1,2].map(function(x) { |
436 | return union(vector_char(0,0,String.fromCharCode('A'.charCodeAt(0)+x)).segments.map(function(x) { | 438 | return union(vector_char(0,0,String.fromCharCode('A'.charCodeAt(0)+x)).segments.map(function(x) { |
437 | return rectangular_extrude(x,{w:2,h:1}); | 439 | return rectangular_extrude(x,{w:2,h:1}); |
438 | })).center().rotateX(90).translate([0,50,0]).rotateZ(x*120+120); | 440 | })).center().rotateX(90).translate([0,50,0]).rotateZ(x*120+120); |
439 | }); | 441 | }); |
440 | return union(rv); | 442 | return union(rv); |
441 | } | 443 | } |
442 | 444 | ||
443 | function microswitch() { | 445 | function microswitch() { |
444 | var screw_connector = new CSG.Properties(); | 446 | var screw_connector = new CSG.Properties(); |
445 | var rv = CSG.cube({ center:[0,0,2.5],radius: [19.8/2,6/2,10/2] }).union( | 447 | var rv = CSG.cube({ center:[0,0,2.5],radius: [19.8/2,6/2,10/2] }).union( |
446 | CSG.cube({ center: [2.5,0.5,6], radius: [2/2,3.5/2,5/2] }) | 448 | CSG.cube({ center: [2.5,0.5,6], radius: [2/2,3.5/2,5/2] }) |
447 | ).union( | 449 | ).union( |
448 | [-8,-1,8].map(function(x) { | 450 | [-8,-1,8].map(function(x) { |
449 | return CSG.cube({ center:[x,0,0], radius: [0.6/2,3.2/2,13/2] }) | 451 | return CSG.cube({ center:[x,0,0], radius: [0.6/2,3.2/2,13/2] }) |
450 | }) | 452 | }) |
451 | ).subtract( | 453 | ).subtract( |
452 | [-9.5/2,9.5/2].map(function(x,i) { | 454 | [-9.5/2,9.5/2].map(function(x,i) { |
453 | screw_connector[i] = new CSG.Connector([x,6/2,0],[0,-1,0],[0,0,1]); | 455 | screw_connector[i] = new CSG.Connector([x,6/2,0],[0,-1,0],[0,0,1]); |
454 | return CSG.cylinder({ | 456 | return CSG.cylinder({ |
455 | start: [x,-4,0], end: [x,4,0], | 457 | start: [x,-4,0], end: [x,4,0], |
456 | radius: 2/2 | 458 | radius: 2/2 |
457 | }) | 459 | }) |
458 | }) | 460 | }) |
459 | ); | 461 | ); |
460 | rv.properties.switch_connector = new CSG.Connector([2.5,0.5,6+5/2],[0,0,1],[0,-1,0]); | 462 | rv.properties.switch_connector = new CSG.Connector([2.5,0.5,6+5/2],[0,0,1],[0,-1,0]); |
461 | rv.properties.screw_connector = screw_connector; | 463 | rv.properties.screw_connector = screw_connector; |
462 | rv.properties.microswitch = new CSG.Properties(); | 464 | rv.properties.microswitch = new CSG.Properties(); |
463 | rv.properties.microswitch.size = new CSG.Vector3D( | 465 | rv.properties.microswitch.size = new CSG.Vector3D( |
464 | 19.8,6,10 | 466 | 19.8,6,10 |
465 | ); | 467 | ); |
466 | return rv; | 468 | return rv; |
467 | } | 469 | } |
468 | 470 | ||
469 | var FOURWINDS = [0,90,180,270]; | 471 | var FOURWINDS = [0,90,180,270]; |
470 | 472 | ||
471 | var E2020 = { | 473 | var E2020 = { |
472 | outer: 20, thickness: 1.8, | 474 | outer: 20, thickness: 1.8, |
473 | roundius: 1, centerhole: 5, | 475 | roundius: 1, centerhole: 5, |
474 | slot_width: 6, | 476 | slot_width: 6, |
475 | T: { width: 10, thickness: 1.5, depth: 6.5 }, | 477 | T: { width: 10, thickness: 1.5, depth: 6.5 }, |
476 | 478 | ||
477 | extrusion: function(o) { | 479 | extrusion: function(o) { |
478 | if(!o) o = {}; | 480 | if(!o) o = {}; |
479 | var e = o.extrusion || this; | 481 | var e = o.extrusion || this; |
480 | var l = o.l||5; | 482 | var l = o.l||5; |
481 | var iy = e.outer/2-e.T.depth; | 483 | var iy = e.outer/2-e.T.depth; |
482 | var ix = e.T.width/2-(e.outer/2-iy-e.thickness-e.T.thickness); | 484 | var ix = e.T.width/2-(e.outer/2-iy-e.thickness-e.T.thickness); |
483 | var rv = CAG.roundedRectangle({ | 485 | var rv = CAG.roundedRectangle({ |
484 | corner1: [-e.outer/2,-e.outer/2], corner2: [e.outer/2,e.outer/2], | 486 | corner1: [-e.outer/2,-e.outer/2], corner2: [e.outer/2,e.outer/2], |
485 | roundradius: e.roundius | 487 | roundradius: e.roundius |
486 | }).subtract( | 488 | }).subtract( |
487 | FOURWINDS.map(function(w) { | 489 | FOURWINDS.map(function(w) { |
488 | return CAG.fromPoints([ | 490 | return CAG.fromPoints([ |
489 | [ e.slot_width/2,e.outer/2+1], | 491 | [ e.slot_width/2,e.outer/2+1], |
490 | [ e.slot_width/2,e.outer/2-e.thickness], | 492 | [ e.slot_width/2,e.outer/2-e.thickness], |
491 | [ e.T.width/2,e.outer/2-e.thickness], | 493 | [ e.T.width/2,e.outer/2-e.thickness], |
492 | [ e.T.width/2,e.outer/2-e.thickness-e.T.thickness], | 494 | [ e.T.width/2,e.outer/2-e.thickness-e.T.thickness], |
493 | [ ix, iy ], | 495 | [ ix, iy ], |
494 | [ -ix, iy ], | 496 | [ -ix, iy ], |
495 | [ -e.T.width/2,e.outer/2-e.thickness-e.T.thickness], | 497 | [ -e.T.width/2,e.outer/2-e.thickness-e.T.thickness], |
496 | [ -e.T.width/2,e.outer/2-e.thickness], | 498 | [ -e.T.width/2,e.outer/2-e.thickness], |
497 | [ -e.slot_width/2,e.outer/2-e.thickness], | 499 | [ -e.slot_width/2,e.outer/2-e.thickness], |
498 | [ -e.slot_width/2,e.outer/2+1], | 500 | [ -e.slot_width/2,e.outer/2+1], |
499 | ]).rotateZ(w); | 501 | ]).rotateZ(w); |
500 | }) | 502 | }) |
501 | ).subtract(CAG.circle({ | 503 | ).subtract(CAG.circle({ |
502 | center: [0,0], radius: e.centerhole/2 | 504 | center: [0,0], radius: e.centerhole/2 |
503 | })).extrude({offset:[0,0,l]}); | 505 | })).extrude({offset:[0,0,l]}); |
504 | rv.properties.c_top=rv.properties.c_left | 506 | rv.properties.c_top=rv.properties.c_left |
505 | = new CSG.Connector([0,0,l],[0,0,-1],[1,0,0]); | 507 | = new CSG.Connector([0,0,l],[0,0,-1],[1,0,0]); |
506 | rv.properties.c_bottom=rv.properties.c_right | 508 | rv.properties.c_bottom=rv.properties.c_right |
507 | = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); | 509 | = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); |
508 | rv.properties.c_midway = new CSG.Connector([0,0,l/2],[0,0,1],[1,0,0]); | 510 | rv.properties.c_midway = new CSG.Connector([0,0,l/2],[0,0,1],[1,0,0]); |
509 | rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); | 511 | rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); |
510 | rv.properties.vitamin = true; | 512 | rv.properties.vitamin = true; |
511 | return rv; | 513 | return rv; |
512 | }, | 514 | }, |
513 | 515 | ||
514 | cap: function extrusion_cap(o) { | 516 | cap: function extrusion_cap(o) { |
515 | if(!o) o = {}; | 517 | if(!o) o = {}; |
516 | var e = o.extrusion || this; | 518 | var e = o.extrusion || this; |
517 | var thickness = o.thickness||2, l = o.l||5; | 519 | var thickness = o.thickness||2, l = o.l||5; |
518 | var rv = CSG.roundedCube({ | 520 | var rv = CSG.roundedCube({ |
519 | corner1: [-e.outer/2,-e.outer/2,thickness], | 521 | corner1: [-e.outer/2,-e.outer/2,thickness], |
520 | corner2: [e.outer/2,e.outer/2,0], | 522 | corner2: [e.outer/2,e.outer/2,0], |
521 | roundradius: [e.roundius,e.roundius,0] | 523 | roundradius: [e.roundius,e.roundius,0] |
522 | }); | 524 | }); |
523 | var fw = [0,90,180,270]; // four winds | 525 | var fw = [0,90,180,270]; // four winds |
524 | var iy = e.outer/2-e.T.depth; | 526 | var iy = e.outer/2-e.T.depth; |
525 | var ix = e.T.width/2-(e.outer/2-iy-e.thickness-e.T.thickness); | 527 | var ix = e.T.width/2-(e.outer/2-iy-e.thickness-e.T.thickness); |
526 | rv = rv.union(fw.map(function(w) { | 528 | rv = rv.union(fw.map(function(w) { |
527 | return CAG.fromPoints([ | 529 | return CAG.fromPoints([ |
528 | [ e.slot_width/2,e.outer/2], | 530 | [ e.slot_width/2,e.outer/2], |
529 | [ e.slot_width/2,e.outer/2-e.thickness], | 531 | [ e.slot_width/2,e.outer/2-e.thickness], |
530 | [ e.T.width/2,e.outer/2-e.thickness], | 532 | [ e.T.width/2,e.outer/2-e.thickness], |
531 | [ e.T.width/2,e.outer/2-e.thickness-e.T.thickness], | 533 | [ e.T.width/2,e.outer/2-e.thickness-e.T.thickness], |
532 | [ ix, iy ], | 534 | [ ix, iy ], |
533 | [ -ix, iy ], | 535 | [ -ix, iy ], |
534 | [ -e.T.width/2,e.outer/2-e.thickness-e.T.thickness], | 536 | [ -e.T.width/2,e.outer/2-e.thickness-e.T.thickness], |
535 | [ -e.T.width/2,e.outer/2-e.thickness], | 537 | [ -e.T.width/2,e.outer/2-e.thickness], |
536 | [ -e.slot_width/2,e.outer/2-e.thickness], | 538 | [ -e.slot_width/2,e.outer/2-e.thickness], |
537 | [ -e.slot_width/2,e.outer/2], | 539 | [ -e.slot_width/2,e.outer/2], |
538 | ]).extrude({offset:[0,0,l+thickness]}).rotateZ(w); | 540 | ]).extrude({offset:[0,0,l+thickness]}).rotateZ(w); |
539 | })); | 541 | })); |
540 | rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); | 542 | rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); |
541 | return rv; | 543 | return rv; |
542 | } | 544 | } |
543 | }; | 545 | }; |
544 | 546 | ||
545 | var THREEWINDS = [0,120,240]; | 547 | var THREEWINDS = [0,120,240]; |
546 | 548 | ||
547 | function base_sides() { | 549 | function base_sides() { |
548 | return [0,1].map(function(l) { | 550 | return [0,1].map(function(l) { |
549 | return THREEWINDS.map(function(w) { | 551 | return THREEWINDS.map(function(w) { |
550 | var e = E2020.extrusion({l:CONFIG.base.el}); | 552 | var e = E2020.extrusion({l:CONFIG.base.el}); |
551 | e = e.connectTo(e.properties.c_midway, | 553 | e = e.connectTo(e.properties.c_midway, |
552 | new CSG.Connector([0,-CD.base.mid_inscription_r,CONFIG.extrusion.w/2],[1,0,0],[0,0,1]), | 554 | new CSG.Connector([0,-CD.base.mid_inscription_r,CONFIG.extrusion.w/2],[1,0,0],[0,0,1]), |
553 | false, 0); | 555 | false, 0); |
554 | return ( e.translate([0,0,CONFIG.foot.h+l*(CONFIG.extrusion.w+CONFIG.base.gap)]) | 556 | return ( e.translate([0,0,CONFIG.foot.h+l*(CONFIG.extrusion.w+CONFIG.base.gap)]) |
555 | .rotateZ(w) | 557 | .rotateZ(w) |
556 | .setColor(CONFIG.color.extrusion) ); | 558 | .setColor(CONFIG.color.extrusion) ); |
557 | }); | 559 | }); |
558 | }); | 560 | }); |
559 | } | 561 | } |
560 | function base_extrusions() { | 562 | function base_extrusions() { |
561 | var rv = union( base_sides().map(function(x){return union(x)}) ); | 563 | var rv = union( base_sides().map(function(x){return union(x)}) ); |
562 | rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); | 564 | rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); |
563 | return rv; | 565 | return rv; |
564 | } | 566 | } |
565 | 567 | ||
566 | function columns() { | 568 | function columns() { |
567 | return THREEWINDS.map(function(w) { | 569 | return THREEWINDS.map(function(w) { |
568 | return (E2020.extrusion({l:CONFIG.column.h}) | 570 | return (E2020.extrusion({l:CONFIG.column.h}) |
569 | .translate([0,CD.base.column_r,CONFIG.foot.h]) | 571 | .translate([0,CD.base.column_r,CONFIG.foot.h]) |
570 | .rotateZ(w).setColor(CONFIG.color.extrusion) | 572 | .rotateZ(w).setColor(CONFIG.color.extrusion) |
571 | ); | 573 | ); |
572 | }); | 574 | }); |
573 | } | 575 | } |
574 | function column_extrusions() { | 576 | function column_extrusions() { |
575 | var rv = union( columns() ); | 577 | var rv = union( columns() ); |
576 | rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); | 578 | rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); |
577 | return rv; | 579 | return rv; |
578 | } | 580 | } |
579 | 581 | ||
580 | function duet() { | 582 | function duet() { |
581 | var C = CONFIG.duet; | 583 | var C = CONFIG.duet; |
582 | var pholes = new CSG.Properties(); | 584 | var pholes = new CSG.Properties(); |
583 | var hx = C.hole_spacing.x/2; | 585 | var hx = C.hole_spacing.x/2; |
584 | var hy = C.hole_spacing.y/2; | 586 | var hy = C.hole_spacing.y/2; |
585 | var hh = { nw: [1,-1], ne: [1,1], se: [-1,1], sw: [-1,-1] }; | 587 | var hh = { nw: [1,-1], ne: [1,1], se: [-1,1], sw: [-1,-1] }; |
586 | var holes = []; | 588 | var holes = []; |
587 | for(w in hh) { | 589 | for(w in hh) { |
588 | var h = hh[w],_x=h[0]*hx,_y=h[1]*hy; | 590 | var h = hh[w],_x=h[0]*hx,_y=h[1]*hy; |
589 | holes.push(CSG.cylinder({start:[_x,_y,-1],end:[_x,_y,C.pcb_size.z+1],radius:3/2})); | 591 | holes.push(CSG.cylinder({start:[_x,_y,-1],end:[_x,_y,C.pcb_size.z+1],radius:3/2})); |
590 | pholes['c_'+w] = new CSG.Connector([_x,_y,0],[0,0,1],[1,0,0]); | 592 | pholes['c_'+w] = new CSG.Connector([_x,_y,0],[0,0,1],[1,0,0]); |
591 | } | 593 | } |
592 | rv = CSG.cube({ | 594 | rv = CSG.cube({ |
593 | corner1: [-C.pcb_size.x/2, -C.pcb_size.y/2, 0], | 595 | corner1: [-C.pcb_size.x/2, -C.pcb_size.y/2, 0], |
594 | corner2: [ C.pcb_size.x/2, C.pcb_size.y/2, C.pcb_size.z] | 596 | corner2: [ C.pcb_size.x/2, C.pcb_size.y/2, C.pcb_size.z] |
595 | }).subtract(holes).setColor(CONFIG.color.pcb).union( | 597 | }).subtract(holes).setColor(CONFIG.color.pcb).union( |
596 | CSG.cube({ | 598 | CSG.cube({ |
597 | corner1: [-C.pcb_size.x/2,-C.hole_spacing.y/2+3,C.pcb_size.z], | 599 | corner1: [-C.pcb_size.x/2,-C.hole_spacing.y/2+3,C.pcb_size.z], |
598 | corner2: [ C.pcb_size.x/2, C.hole_spacing.y/2-3,C.h] | 600 | corner2: [ C.pcb_size.x/2, C.hole_spacing.y/2-3,C.h] |
599 | }).setColor(CONFIG.color.bulk) | 601 | }).setColor(CONFIG.color.bulk) |
600 | ); | 602 | ); |
601 | rv.properties.holes = pholes; | 603 | rv.properties.holes = pholes; |
602 | rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); | 604 | rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); |
603 | rv.properties.vitamin = true; | 605 | rv.properties.vitamin = true; |
604 | return rv; | 606 | return rv; |
605 | } | 607 | } |
606 | 608 | ||
607 | function foot() { | 609 | function foot() { |
608 | var F = CONFIG.foot; | 610 | var F = CONFIG.foot; |
609 | var br = F.bolt.hd/2+F.margin; | 611 | var br = F.bolt.hd/2+F.margin; |
610 | var bh = F.zscalefactor*Math.sqrt(Math.pow(F.d/2,2)-Math.pow(br,2)); | 612 | var bh = F.zscalefactor*Math.sqrt(Math.pow(F.d/2,2)-Math.pow(br,2)); |
611 | var th = F.h-bh; | 613 | var th = F.h-bh; |
612 | var r = 2*F.d; | 614 | var r = 2*F.d; |
613 | var rv = CSG.sphere({ // botom contorted sphere | 615 | var rv = CSG.sphere({ // botom contorted sphere |
614 | center: [0,0,0], radius: F.d/2, resolution: r | 616 | center: [0,0,0], radius: F.d/2, resolution: r |
615 | }).scale([1,1,F.zscalefactor]).translate([0,0,bh]).union(CSG.cylinder({ // top hat | 617 | }).scale([1,1,F.zscalefactor]).translate([0,0,bh]).union(CSG.cylinder({ // top hat |
616 | start: [0,0,bh], end: [0,0,F.h], radius: F.d/2, resolution: r | 618 | start: [0,0,bh], end: [0,0,F.h], radius: F.d/2, resolution: r |
617 | })).intersect(CSG.cylinder({ // cut off excess | 619 | })).intersect(CSG.cylinder({ // cut off excess |
618 | start: [0,0,0], end: [0,0,F.h], radius: F.d | 620 | start: [0,0,0], end: [0,0,F.h], radius: F.d |
619 | })).subtract([ | 621 | })).subtract([ |
620 | CSG.cylinder({ // bolt hole | 622 | CSG.cylinder({ // bolt hole |
621 | start: [0,0,-1], end: [0,0,F.h+1], radius: F.bolt.d/2+PRINT.slide_tolerance | 623 | start: [0,0,-1], end: [0,0,F.h+1], radius: F.bolt.d/2+PRINT.slide_tolerance |
622 | }), CSG.cylinder({ // nut hole | 624 | }), CSG.cylinder({ // nut hole |
623 | start: [0,0,F.h-F.nut.h-PRINT.play_tolerance], | 625 | start: [0,0,F.h-F.nut.h-PRINT.play_tolerance], |
624 | end: [0,0,F.h], | 626 | end: [0,0,F.h], |
625 | radius: F.nut.d/2+PRINT.slide_tolerance, resolution: 6 | 627 | radius: F.nut.d/2+PRINT.slide_tolerance, resolution: 6 |
626 | }), CSG.cylinder({ // bolthead/washer hole | 628 | }), CSG.cylinder({ // bolthead/washer hole |
627 | start: [0,0,-1], end: [0,0,F.h-F.nut.h-PRINT.play_tolerance-F.shell], | 629 | start: [0,0,-1], end: [0,0,F.h-F.nut.h-PRINT.play_tolerance-F.shell], |
628 | radius: F.bolt.hd/2+PRINT.play_tolerance | 630 | radius: F.bolt.hd/2+PRINT.play_tolerance |
629 | }) | 631 | }) |
630 | ]).union(CSG.cylinder({ // bridging patch | 632 | ]).union(CSG.cylinder({ // bridging patch |
631 | start: [0,0,F.h-F.nut.h-PRINT.play_tolerance-PRINT.layer_height], | 633 | start: [0,0,F.h-F.nut.h-PRINT.play_tolerance-PRINT.layer_height], |
632 | end: [0,0,F.h-F.nut.h-PRINT.play_tolerance], | 634 | end: [0,0,F.h-F.nut.h-PRINT.play_tolerance], |
633 | radius: F.nut.d/2 | 635 | radius: F.nut.d/2 |
634 | })); | 636 | })); |
635 | rv.properties.c_column = new CSG.Connector([0,0,F.h],[0,0,1],[1,0,0]); | 637 | rv.properties.c_column = new CSG.Connector([0,0,F.h],[0,0,1],[1,0,0]); |
636 | rv.properties.P = new CSG.Connector([0,0,F.h],[0,0,-1],[1,0,0]); | 638 | rv.properties.P = new CSG.Connector([0,0,F.h],[0,0,-1],[1,0,0]); |
637 | return rv.setColor(CONFIG.color.parts); | 639 | return rv.setColor(CONFIG.color.parts); |
638 | } | 640 | } |
641 | function foot_foot() { | ||
642 | // TODO: connect in the altogethernow? | ||
643 | var F = CONFIG.foot; | ||
644 | var rv = CSG.cylinder({ | ||
645 | start: [0,0,0], end: [0,0,F.foot.ho], | ||
646 | radius: F.bolt.hd/2+F.margin | ||
647 | }).union(CSG.cylinder({ | ||
648 | start: [0,0,0], end: [0,0,F.foot.ho+F.foot.hi], | ||
649 | radius: F.bolt.hd/2+PRINT.play_tolerance-PRINT.fit_tolerance | ||
650 | })); | ||
651 | rv.properties.c_foot = new CSG.Connector([0,0,F.foot.ho],[0,0,1],[1,0,0]); | ||
652 | rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); | ||
653 | return rv.setColor(CONFIG.color.softparts); | ||
654 | } | ||
639 | 655 | ||
640 | function refaxes(o) { | 656 | function refaxes(o) { |
641 | if(!o) o = {}; | 657 | if(!o) o = {}; |
642 | var l = o.l||20, g = o.g||0.7; | 658 | var l = o.l||20, g = o.g||0.7; |
643 | return union([ | 659 | return union([ |
644 | CSG.roundedCylinder({start:[0,0,0],end:[l,0,0]}).setColor([1,0,0,g]), | 660 | CSG.roundedCylinder({start:[0,0,0],end:[l,0,0]}).setColor([1,0,0,g]), |
645 | CSG.roundedCylinder({start:[0,0,0],end:[0,l,0]}).setColor([0,1,0,g]), | 661 | CSG.roundedCylinder({start:[0,0,0],end:[0,l,0]}).setColor([0,1,0,g]), |
646 | CSG.roundedCylinder({start:[0,0,0],end:[0,0,l]}).setColor([0,0,1,g]) | 662 | CSG.roundedCylinder({start:[0,0,0],end:[0,0,l]}).setColor([0,0,1,g]) |
647 | ]); | 663 | ]); |
648 | } | 664 | } |
649 | 665 | ||
650 | function P(x) { | 666 | function P(x) { |
651 | return x.connectTo(x.properties.P,new CSG.Connector([0,0,0],[0,0,1],[1,0,0]), false, 0); | 667 | return x.connectTo(x.properties.P,new CSG.Connector([0,0,0],[0,0,1],[1,0,0]), false, 0); |
652 | } | 668 | } |
653 | 669 | ||
654 | var PARTS = { | 670 | var PARTS = { |
655 | wip: function(params) { | 671 | wip: function(params) { |
656 | return foot(); | 672 | return foot(); |
657 | return union(base_extrusions(),column_extrusions(),duet()); | 673 | return union(base_extrusions(),column_extrusions(),duet()); |
658 | alltogethernow: function(params) { | 674 | alltogethernow: function(params) { |
659 | var cols = columns(); | 675 | var cols = columns(); |
660 | var sides = base_sides(); | 676 | var sides = base_sides(); |
661 | var feet = THREEWINDS.map(function(w,i) { | 677 | var feet = THREEWINDS.map(function(w,i) { |
662 | var rv = foot(); | 678 | var rv = foot(); |
663 | rv = rv.connectTo(rv.properties.c_column,cols[i].properties.c_bottom,false,0); | 679 | rv = rv.connectTo(rv.properties.c_column,cols[i].properties.c_bottom,false,0); |
664 | return rv; | 680 | return rv; |
665 | }); | 681 | }); |
666 | var rv = union(cols).union(sides.map(union)).union(feet); | 682 | var rv = union(cols).union(sides.map(union)).union(feet); |
667 | rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); | 683 | rv.properties.P = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); |
668 | return rv; | 684 | return rv; |
669 | } | 685 | } |
670 | }; | 686 | }; |
671 | 687 | ||
672 | function main(params) { | 688 | function main(params) { |
673 | var part = params.part && PARTS[params.part]; | 689 | var part = params.part && PARTS[params.part]; |
674 | if(!part) return refaxes(); | 690 | if(!part) return refaxes(); |
675 | var rv = P(part(params)); | 691 | var rv = P(part(params)); |
676 | if(!params.print) rv = rv.union(refaxes()); | 692 | if(!params.print) rv = rv.union(refaxes()); |
677 | return rv; | 693 | return rv; |
678 | } | 694 | } |
679 | 695 | ||
680 | function _main(params) { | 696 | function _main(params) { |
681 | var e = EFFECTOR.effector(); | 697 | var e = EFFECTOR.effector(); |
682 | var hs = E3DV6.heatsink(); | 698 | var hs = E3DV6.heatsink(); |
683 | hs = hs.connectTo(hs.properties.grove_connector,e.properties.grove_connector,false,0); | 699 | hs = hs.connectTo(hs.properties.grove_connector,e.properties.grove_connector,false,0); |
684 | var ms = microswitch(); | 700 | var ms = microswitch(); |
685 | var hd = EFFECTOR.hinged({ | 701 | var hd = EFFECTOR.hinged({ |
686 | microswitch:ms,effector:e | 702 | microswitch:ms,effector:e |
687 | }); | 703 | }); |
688 | ms = ms.connectTo( | 704 | ms = ms.connectTo( |
689 | ms.properties.screw_connector[0], | 705 | ms.properties.screw_connector[0], |
690 | hd.properties.microswitch_screw_connector[0], | 706 | hd.properties.microswitch_screw_connector[0], |
691 | false, 0); | 707 | false, 0); |
692 | var hdhd = EFFECTOR.split_hinged(hd); | 708 | var hdhd = EFFECTOR.split_hinged(hd); |
693 | var fh = EFFECTOR.fanholder(); | 709 | var fh = EFFECTOR.fanholder(); |
694 | return union({ | 710 | return union({ |
695 | platform: e, | 711 | platform: e, |
696 | hinged: hdhd[1], | 712 | hinged: hdhd[1], |
697 | clamp: hdhd[0], | 713 | clamp: hdhd[0], |
698 | fanholder: fh, | 714 | fanholder: fh, |
699 | alltogethernow: [e,hdhd[0],hdhd[1], columns(),hs,ms,fh] | 715 | alltogethernow: [e,hdhd[0],hdhd[1], columns(),hs,ms,fh] |
700 | }[params.part||'alltogethernow']) | 716 | }[params.part||'alltogethernow']) |
701 | var rv = union( | 717 | var rv = union( |
702 | e, | 718 | e, |
703 | hs, | 719 | hs, |
704 | columns(), | 720 | columns(), |
705 | ///hd, | 721 | ///hd, |
706 | hdhd[0], hdhd[1], | 722 | hdhd[0], hdhd[1], |
707 | ms); | 723 | ms); |
708 | return rv; | 724 | return rv; |
709 | } | 725 | } |
710 | 726 | ||
711 | function getParameterDefinitions() { | 727 | function getParameterDefinitions() { |
712 | return [{ | 728 | return [{ |
713 | name: 'part', | 729 | name: 'part', |
714 | type: 'choice', | 730 | type: 'choice', |
715 | values: [ | 731 | values: [ |
716 | 'platform', | 732 | 'platform', |
717 | 'hinged', | 733 | 'hinged', |
718 | 'clamp', | 734 | 'clamp', |
719 | 'fanholder', | 735 | 'fanholder', |
720 | 'alltogethernow', | 736 | 'alltogethernow', |
721 | 'wip' | 737 | 'wip' |
722 | ], | 738 | ], |
723 | captions: [ | 739 | captions: [ |
724 | 'Effector platform', | 740 | 'Effector platform', |
725 | 'Hinged part', | 741 | 'Hinged part', |
726 | 'Clamp', | 742 | 'Clamp', |
727 | 'Fan holder', | 743 | 'Fan holder', |
728 | 'All together now!', | 744 | 'All together now!', |
729 | 'Work in progress' | 745 | 'Work in progress' |
730 | ], | 746 | ], |
731 | caption: 'Part', | 747 | caption: 'Part', |
732 | initial: 'wip' | 748 | initial: 'wip' |
733 | },{ | 749 | },{ |
734 | name: 'print', | 750 | name: 'print', |
735 | type: 'checkbox', | 751 | type: 'checkbox', |
736 | caption: 'For print, no nonsense', | 752 | caption: 'For print, no nonsense', |
737 | initial: false | 753 | initial: false |
738 | }]; | 754 | }]; |
739 | } | 755 | } |
740 | 756 | ||
741 | /* vim:set ft=javascript ai: */ | 757 | /* vim:set ft=javascript ai: */ |