-rw-r--r-- | delta.jscad | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/delta.jscad b/delta.jscad index baa977d..547b51e 100644 --- a/delta.jscad +++ b/delta.jscad | |||
@@ -1,169 +1,193 @@ | |||
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 | side: { | 9 | extrusion: { |
10 | w: 20 | ||
11 | }, | ||
12 | base: { | ||
10 | el: 240, // side extrusion length | 13 | el: 240, // side extrusion length |
11 | tl: 240+2*70, // triangle side length | 14 | sl: 240+2*70, // triangle side length |
12 | gap: 9 // vertical gap between side extrusions | 15 | gap: 9 // vertical gap between side extrusions |
13 | }, | 16 | }, |
14 | column: { | 17 | column: { |
15 | h: 600 // column height | 18 | h: 600 // column height |
16 | }, | 19 | }, |
17 | heatbed: { | 20 | heatbed: { |
18 | r: 220/2, // heatbed radius | 21 | r: 220/2, // heatbed radius |
19 | sr: 220/2-4.5,// radius of the screwholes circle | 22 | sr: 220/2-4.5,// radius of the screwholes circle |
20 | h: 3+1.5 // thickness (including insulation) | 23 | h: 3+1.5 // thickness (including insulation) |
21 | }, | 24 | }, |
22 | glass: { | 25 | glass: { |
23 | r: 195/2, // glass radius | 26 | r: 195/2, // glass radius |
24 | h: 3 // glass thickness | 27 | h: 3 // glass thickness |
25 | }, | 28 | }, |
26 | hotend: { | 29 | hotend: { |
27 | h: 62.4, // full assembly height | 30 | h: 62.4, // full assembly height |
28 | groove: { d:12, h:6 }, // grove diameter and height | 31 | groove: { d:12, h:6 }, // grove diameter and height |
29 | ungroove: { d:16, above:3.7, below: 3+4 } | 32 | ungroove: { d:16, above:3.7, below: 3+4 } |
30 | }, | 33 | }, |
31 | effector: { | 34 | effector: { |
32 | h: 6, | 35 | h: 6, |
33 | o: 20,// offset to the rod mounts line | 36 | o: 20,// offset to the rod mounts line |
34 | rods_apart: 40, | 37 | rods_apart: 40, |
35 | cone: { shell: 1, angle: Math.PI/6 }, | 38 | cone: { shell: 1, angle: Math.PI/6 }, |
36 | rodend: { | 39 | rodend: { |
37 | joint_w: 7,// thickness of the joint | 40 | joint_w: 7,// thickness of the joint |
38 | screw_l: 20-1, // 20 with the head | 41 | screw_l: 20-1, // 20 with the head |
39 | screw_d: 3 | 42 | screw_d: 3 |
40 | }, | 43 | }, |
41 | hotend: { margin: 2 }, | 44 | hotend: { margin: 2 }, |
42 | hinge: { | 45 | hinge: { |
43 | d: 3, w: 5, margin: 2.5, | 46 | d: 3, w: 5, margin: 2.5, |
44 | h: 1+(6+3.7)/2, // elevation + grove + top | 47 | h: 1+(6+3.7)/2, // elevation + grove + top |
45 | e: 1 // elevation | 48 | e: 1 // elevation |
46 | }, | 49 | }, |
47 | clamp: { | 50 | clamp: { |
48 | shell: 4.6, | 51 | shell: 4.6, |
49 | d: 3, | 52 | d: 3, |
50 | margin: 2.5, | 53 | margin: 2.5, |
51 | split: 0.6 | 54 | split: 0.6 |
52 | }, | 55 | }, |
53 | mswitch: { | 56 | mswitch: { |
54 | size: [ 19.8, 6, 10 ], | 57 | size: [ 19.8, 6, 10 ], |
55 | screw: { | 58 | screw: { |
56 | d: 2, h: 10/2-2, | 59 | d: 2, h: 10/2-2, |
57 | s: 1.3, // screw shell | 60 | s: 1.3, // screw shell |
58 | o: [-9.5/2,9.5/2].map(function(x) { | 61 | o: [-9.5/2,9.5/2].map(function(x) { |
59 | return -19.8/2+x; | 62 | return -19.8/2+x; |
60 | }) | 63 | }) |
61 | }, | 64 | }, |
62 | switch_x: 2.5 | 65 | switch_x: 2.5 |
63 | }, | 66 | }, |
64 | guide: { | 67 | guide: { |
65 | width: 3, height: 5+1, length: 6 | 68 | width: 3, height: 5+1, length: 6 |
66 | }, | 69 | }, |
67 | fanholder: { | 70 | fanholder: { |
68 | r: 30, | 71 | r: 30, |
69 | screw: { d: 3, m: 2.5/*margin*/ }, | 72 | screw: { d: 3, m: 2.5/*margin*/ }, |
70 | w: 3 | 73 | w: 3 |
71 | } | 74 | } |
72 | }, | 75 | }, |
73 | nut: { h: 2.3, w: 5.5 } | 76 | nut: { h: 2.3, w: 5.5 }, |
77 | color: { | ||
78 | extrusion: [0.8, 0.8, 0.8, 0.8] | ||
79 | } | ||
80 | }; | ||
81 | |||
82 | var CD = { | ||
83 | base: (function(){ | ||
84 | var rv = {}; | ||
85 | rv.circumscription_r = | ||
86 | CONFIG.base.sl/2/Math.cos(Math.PI/6); | ||
87 | rv.outer_inscription_r = | ||
88 | Math.sqrt(Math.pow(rv.circumscription_r,2)- | ||
89 | Math.pow(CONFIG.base.sl/2,2)); | ||
90 | rv.mid_inscription_r = | ||
91 | rv.outer_inscription_r-CONFIG.extrusion.w/2; | ||
92 | rv.inner_inscription_r = | ||
93 | rv.outer_inscription_r-CONFIG.extrusion.w/2; | ||
94 | // TODO: properly calculate | ||
95 | rv.column_r = rv.circumscription_r - 48.29; | ||
96 | return rv; | ||
97 | })() | ||
74 | }; | 98 | }; |
75 | 99 | ||
76 | var U = { | 100 | var U = { |
77 | hypotenuse: function(a,b) { | 101 | hypotenuse: function(a,b) { |
78 | return Math.sqrt(Math.pow(a,2)+Math.pow(b,2)); | 102 | return Math.sqrt(Math.pow(a,2)+Math.pow(b,2)); |
79 | }, | 103 | }, |
80 | peek: function(x,m) { | 104 | peek: function(x,m) { |
81 | console.log(x,m); | 105 | console.log(x,m); |
82 | return x; | 106 | return x; |
83 | } | 107 | } |
84 | }; | 108 | }; |
85 | 109 | ||
86 | /* {h:,w:} */ | 110 | /* {h:,w:} */ |
87 | function nut(o) { | 111 | function nut(o) { |
88 | var rv = CSG.cylinder({ | 112 | var rv = CSG.cylinder({ |
89 | start:[0,0,0],end:[0,0,o.h], | 113 | start:[0,0,0],end:[0,0,o.h], |
90 | radius: o.w/2/Math.cos(Math.PI/6), | 114 | radius: o.w/2/Math.cos(Math.PI/6), |
91 | resolution: 6 | 115 | resolution: 6 |
92 | }); | 116 | }); |
93 | rv.properties.axis_connector = new CSG.Connector([0,0,0],[0,0,1],[0,1,0]); | 117 | rv.properties.axis_connector = new CSG.Connector([0,0,0],[0,0,1],[0,1,0]); |
94 | return rv; | 118 | return rv; |
95 | } | 119 | } |
96 | 120 | ||
97 | var E3DV6 = { | 121 | var E3DV6 = { |
98 | dimensions: { | 122 | dimensions: { |
99 | big_d: 22.3, | 123 | big_d: 22.3, |
100 | 124 | ||
101 | }, | 125 | }, |
102 | heatsink: function() { | 126 | heatsink: function() { |
103 | var fn = 16; | 127 | var fn = 16; |
104 | var z=0; | 128 | var z=0; |
105 | var unite = [ {d:16,h:3.7},{d:12,h:6},{d:16,h:3} ].map(function(x) { | 129 | var unite = [ {d:16,h:3.7},{d:12,h:6},{d:16,h:3} ].map(function(x) { |
106 | return CSG.cylinder({ | 130 | return CSG.cylinder({ |
107 | start: [0,0,z], end: [0,0,z-=x.h], | 131 | start: [0,0,z], end: [0,0,z-=x.h], |
108 | radius: x.d/2, resolution: fn | 132 | radius: x.d/2, resolution: fn |
109 | }); | 133 | }); |
110 | }); | 134 | }); |
111 | unite.push(CSG.cylinder({ | 135 | unite.push(CSG.cylinder({ |
112 | start:[0,0,z-=1.5], end:[0,0,z-=1], | 136 | start:[0,0,z-=1.5], end:[0,0,z-=1], |
113 | radius: 16/2, resolution: fn | 137 | radius: 16/2, resolution: fn |
114 | })); | 138 | })); |
115 | for(var i=0;i<11;++i) unite.push(CSG.cylinder({ | 139 | for(var i=0;i<11;++i) unite.push(CSG.cylinder({ |
116 | start:[0,0,z-=1.5], end:[0,0,z-=1], | 140 | start:[0,0,z-=1.5], end:[0,0,z-=1], |
117 | radius: this.dimensions.big_d/2, resolution: fn | 141 | radius: this.dimensions.big_d/2, resolution: fn |
118 | })); | 142 | })); |
119 | unite.push(CSG.cylinder({ | 143 | unite.push(CSG.cylinder({ |
120 | start:[0,0,z], end: [0,0,-12.7], | 144 | start:[0,0,z], end: [0,0,-12.7], |
121 | radiusStart: 10/2, radiusEnd: 8.5/2, /* pretty arbitrary */ | 145 | radiusStart: 10/2, radiusEnd: 8.5/2, /* pretty arbitrary */ |
122 | resolution: fn | 146 | resolution: fn |
123 | })); | 147 | })); |
124 | var rv = union(unite); | 148 | var rv = union(unite); |
125 | rv = rv.subtract([CSG.cylinder({ | 149 | rv = rv.subtract([CSG.cylinder({ |
126 | start:[0,0,1], end: [0,0,z-1], | 150 | start:[0,0,1], end: [0,0,z-1], |
127 | radius: 4.2/2, resolution: fn | 151 | radius: 4.2/2, resolution: fn |
128 | }),CSG.cylinder({ | 152 | }),CSG.cylinder({ |
129 | start:[0,0,1], end: [0,0,-6.7/*somewhat arbitrary*/], | 153 | start:[0,0,1], end: [0,0,-6.7/*somewhat arbitrary*/], |
130 | radius: 8/2, resolution: fn | 154 | radius: 8/2, resolution: fn |
131 | }),CSG.cylinder({ | 155 | }),CSG.cylinder({ |
132 | start:[0,0,z-1], end: [0,0,z+14.8], | 156 | start:[0,0,z-1], end: [0,0,z+14.8], |
133 | radius: 6/2 /*M7*/, resolution: fn | 157 | radius: 6/2 /*M7*/, resolution: fn |
134 | })]); | 158 | })]); |
135 | rv.properties.pushfit_connector = new CSG.Connector([0,0,0],[0,0,-1],[1,0,0]); | 159 | rv.properties.pushfit_connector = new CSG.Connector([0,0,0],[0,0,-1],[1,0,0]); |
136 | rv.properties.heatbreak_connector = new CSG.Connector([0,0,z+14.8],[0,0,-1],[1,0,0]); | 160 | rv.properties.heatbreak_connector = new CSG.Connector([0,0,z+14.8],[0,0,-1],[1,0,0]); |
137 | rv.properties.grove_connector = new CSG.Connector([0,0,-3.7-3],[0,0,1],[1,0,0]); | 161 | rv.properties.grove_connector = new CSG.Connector([0,0,-3.7-3],[0,0,1],[1,0,0]); |
138 | return rv.setColor([0.8,0.8,0.8,0.9]); | 162 | return rv.setColor([0.8,0.8,0.8,0.9]); |
139 | } | 163 | } |
140 | }; | 164 | }; |
141 | 165 | ||
142 | var EFFECTOR = { | 166 | var EFFECTOR = { |
143 | /* {sd: screw diameter, l: cone length, s: screw shell, a: angle from axis} */ | 167 | /* {sd: screw diameter, l: cone length, s: screw shell, a: angle from axis} */ |
144 | cone: function effector_cone(o) { | 168 | cone: function effector_cone(o) { |
145 | var re = o.sd/2+o.s, rs = re+o.l*Math.tan(o.a||(Math.PI/4)); | 169 | var re = o.sd/2+o.s, rs = re+o.l*Math.tan(o.a||(Math.PI/4)); |
146 | var rv = CSG.cylinder({ | 170 | var rv = CSG.cylinder({ |
147 | start: [0,0,0], end: [0,0,o.l], | 171 | start: [0,0,0], end: [0,0,o.l], |
148 | radiusStart: rs, radiusEnd: re, | 172 | radiusStart: rs, radiusEnd: re, |
149 | resolution: Math.floor(rs*2*2) | 173 | resolution: Math.floor(rs*2*2) |
150 | }).subtract(CSG.cylinder({ | 174 | }).subtract(CSG.cylinder({ |
151 | start:[0,0,-1], end:[0,0,o.l+1], radius: o.sd, | 175 | start:[0,0,-1], end:[0,0,o.l+1], radius: o.sd, |
152 | //resolution: Math.floor(o.sd*2*2) | 176 | //resolution: Math.floor(o.sd*2*2) |
153 | })); | 177 | })); |
154 | rv.properties.top_connector = new CSG.Connector([0,0,o.l],[0,0,-1],[1,0,0]); | 178 | rv.properties.top_connector = new CSG.Connector([0,0,o.l],[0,0,-1],[1,0,0]); |
155 | rv.properties.bottom_connector = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); | 179 | rv.properties.bottom_connector = new CSG.Connector([0,0,0],[0,0,1],[1,0,0]); |
156 | var nuthole = nut(CONFIG.nut); | 180 | var nuthole = nut(CONFIG.nut); |
157 | rv = rv.subtract(nuthole.connectTo( | 181 | rv = rv.subtract(nuthole.connectTo( |
158 | nuthole.properties.axis_connector, rv.properties.bottom_connector, | 182 | nuthole.properties.axis_connector, rv.properties.bottom_connector, |
159 | false, 0 | 183 | false, 0 |
160 | )); | 184 | )); |
161 | return rv.intersect(CSG.cylinder({start:[0,0,0],end:[0,0,o.l],radius:6/*TODO:calculate*/})); | 185 | return rv.intersect(CSG.cylinder({start:[0,0,0],end:[0,0,o.l],radius:6/*TODO:calculate*/})); |
162 | }, | 186 | }, |
163 | platform_bb: function platform_bb() { | 187 | platform_bb: function platform_bb() { |
164 | var e = CONFIG.effector; | 188 | var e = CONFIG.effector; |
165 | var r = U.hypotenuse(e.rods_apart/2,e.o+e.rodend.screw_d/2+e.cone.shell); | 189 | var r = U.hypotenuse(e.rods_apart/2,e.o+e.rodend.screw_d/2+e.cone.shell); |
166 | var rv = CSG.sphere({ | 190 | var rv = CSG.sphere({ |
167 | center: [0,0,e.h/2], radius: r, | 191 | center: [0,0,e.h/2], radius: r, |
168 | resolution: r*2*2 | 192 | resolution: r*2*2 |
169 | }).intersect(CSG.cube({ | 193 | }).intersect(CSG.cube({ |