paul@22 | 1 | /* |
paul@22 | 2 | Copyright (C) 2014 Paul Boddie |
paul@22 | 3 | |
paul@22 | 4 | This program is free software; you can redistribute it and/or modify it under |
paul@22 | 5 | the terms of the GNU General Public License as published by the Free Software |
paul@22 | 6 | Foundation; either version 3 of the License, or (at your option) any later |
paul@22 | 7 | version. |
paul@22 | 8 | |
paul@22 | 9 | This program is distributed in the hope that it will be useful, but WITHOUT |
paul@22 | 10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
paul@22 | 11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
paul@22 | 12 | more details. |
paul@22 | 13 | |
paul@22 | 14 | You should have received a copy of the GNU General Public License along with |
paul@22 | 15 | this program. If not, see <http://www.gnu.org/licenses/>. |
paul@22 | 16 | */ |
paul@22 | 17 | |
paul@0 | 18 | module cartridge() |
paul@0 | 19 | { |
paul@0 | 20 | $fn = 50; |
paul@0 | 21 | |
paul@22 | 22 | /* |
paul@22 | 23 | Rounding/fillet radius and additional margin of subtracted |
paul@22 | 24 | material. The additional margin helps avoid geometry problems. |
paul@22 | 25 | */ |
paul@3 | 26 | |
paul@23 | 27 | rr = 2; |
paul@3 | 28 | ro = rr; |
paul@3 | 29 | extra = 0.1; |
paul@3 | 30 | |
paul@0 | 31 | module fillet(r, h) { |
paul@0 | 32 | translate([0, 0, -h/2]) |
paul@0 | 33 | difference() { |
paul@12 | 34 | cube([r + extra, r + extra, h + extra]); |
paul@0 | 35 | cylinder(r = r, h = h); |
paul@0 | 36 | } |
paul@0 | 37 | } |
paul@0 | 38 | |
paul@20 | 39 | /* |
paul@21 | 40 | Justify an object of the given dimensions, according to the given |
paul@21 | 41 | factors (where 1 indicates moving the object to the positive side of an |
paul@21 | 42 | axis, and -1 indicates moving it to the negative side of an axis). |
paul@21 | 43 | |
paul@21 | 44 | NOTE: child should eventually be replaced by children. |
paul@21 | 45 | */ |
paul@21 | 46 | module justify(width, depth, height, wdir, ddir, hdir) { |
paul@21 | 47 | translate([ |
paul@21 | 48 | wdir * width / 2, |
paul@21 | 49 | ddir * depth / 2, |
paul@21 | 50 | hdir * height / 2]) |
paul@21 | 51 | child(); |
paul@21 | 52 | } |
paul@21 | 53 | |
paul@21 | 54 | /* |
paul@20 | 55 | Make a cuboid of the given dimensions, justifying it according to the given |
paul@21 | 56 | factors, and moving it to the specified coordinates. |
paul@21 | 57 | |
paul@21 | 58 | NOTE: Usage of justify within this module will not work due to recursion |
paul@21 | 59 | NOTE: limitations in openscad, potentially removed in more recent |
paul@21 | 60 | NOTE: releases. Thus, the justify transform is merged in here. |
paul@20 | 61 | */ |
paul@20 | 62 | module cube_at(width, depth, height, wdir, ddir, hdir, x, y, z) { |
paul@20 | 63 | translate([ |
paul@20 | 64 | x + wdir * width / 2, |
paul@20 | 65 | y + ddir * depth / 2, |
paul@20 | 66 | z + hdir * height / 2]) |
paul@20 | 67 | cube([width, depth, height], center = true); |
paul@20 | 68 | } |
paul@20 | 69 | |
paul@38 | 70 | /* Internal dimensions. */ |
paul@0 | 71 | |
paul@38 | 72 | int_width = 86.0; |
paul@38 | 73 | int_payload_height = 51.8; /* includes bottom of payload area */ |
paul@38 | 74 | int_connector_height = 13.5; /* height of bottom/floor of payload area */ |
paul@38 | 75 | int_depth = 11.0; |
paul@0 | 76 | |
paul@24 | 77 | /* Side thicknesses. */ |
paul@24 | 78 | |
paul@24 | 79 | front = 2; |
paul@24 | 80 | back = 3.5; |
paul@24 | 81 | top = 3; |
paul@34 | 82 | side = 2; /* increased from 1.5 for 3D printing reliability */ |
paul@34 | 83 | |
paul@38 | 84 | /* How much extra depth the back provides for mating with the front. */ |
paul@38 | 85 | |
paul@38 | 86 | groove_width_extra = 2.0; |
paul@38 | 87 | |
paul@39 | 88 | /* Division of pieces into front and back, defining the extents. */ |
paul@38 | 89 | |
paul@39 | 90 | int_front_depth = 4.5; |
paul@39 | 91 | front_depth = int_front_depth + front; |
paul@39 | 92 | int_back_depth = int_depth - int_front_depth + groove_width_extra; |
paul@39 | 93 | back_depth = int_back_depth + back; |
paul@38 | 94 | |
paul@38 | 95 | /* Cartridge dimensions. */ |
paul@38 | 96 | |
paul@38 | 97 | width = int_width + side + side; |
paul@38 | 98 | height = int_payload_height + int_connector_height + top; |
paul@38 | 99 | depth = int_depth + front + back; |
paul@38 | 100 | |
paul@38 | 101 | /* Cartridge surfaces. */ |
paul@38 | 102 | |
paul@34 | 103 | front_side = side; |
paul@29 | 104 | front_left = front_side; |
paul@29 | 105 | front_right = front_side; |
paul@34 | 106 | back_side = side; |
paul@29 | 107 | back_left = back_side; |
paul@29 | 108 | back_right = back_side; |
paul@36 | 109 | bottom = 1; |
paul@24 | 110 | |
paul@20 | 111 | /* Label details. */ |
paul@1 | 112 | |
paul@1 | 113 | front_label_width = 83.0; |
paul@1 | 114 | front_label_height = 46.0; |
paul@1 | 115 | front_label_depth = 1.0; |
paul@1 | 116 | front_label_offset_from_bottom = 19.5; |
paul@3 | 117 | |
paul@1 | 118 | top_label_width = front_label_width; |
paul@20 | 119 | top_label_height = 11.5; /* the height as seen from above */ |
paul@1 | 120 | top_label_depth = front_label_depth; |
paul@1 | 121 | top_label_offset_from_front = 2.5; |
paul@3 | 122 | |
paul@20 | 123 | /* The groove around the sides and top. */ |
paul@20 | 124 | |
paul@30 | 125 | groove_width_exposed = 1.5; |
paul@30 | 126 | groove_width = groove_width_exposed + groove_width_extra; |
paul@8 | 127 | groove_depth = 1.0; /* how deep the groove goes into each side */ |
paul@20 | 128 | |
paul@20 | 129 | /* Additional cutting to mate the back and front. */ |
paul@20 | 130 | |
paul@31 | 131 | top_groove_width = groove_width_extra; |
paul@8 | 132 | top_groove_depth = 2.0; |
paul@20 | 133 | |
paul@29 | 134 | /* |
paul@29 | 135 | Space for the inner edge of the back inside the front. |
paul@29 | 136 | Offsets are measured from the outside surfaces. |
paul@29 | 137 | */ |
paul@20 | 138 | |
paul@28 | 139 | inner_top_front_cutout_width = width - back_left - back_right; |
paul@30 | 140 | inner_top_front_cutout_depth = top_groove_width; |
paul@30 | 141 | inner_top_front_cutout_height = top - top_groove_depth; |
paul@30 | 142 | inner_top_front_cutout_offset = top_groove_depth; |
paul@28 | 143 | |
paul@28 | 144 | inner_side_front_cutout_height = height - inner_top_front_cutout_offset; |
paul@30 | 145 | inner_side_front_cutout_width = front_side - groove_depth; |
paul@30 | 146 | inner_side_front_cutout_depth = groove_width_extra; |
paul@30 | 147 | inner_side_front_cutout_offset = groove_depth; |
paul@1 | 148 | |
paul@35 | 149 | /* |
paul@35 | 150 | The back cavity is the indented part at the bottom of the back of the |
paul@40 | 151 | cartridge. It appears to be mechanically superfluous, just making the |
paul@40 | 152 | shape of the cartridge look a bit fancier. |
paul@35 | 153 | */ |
paul@35 | 154 | |
paul@4 | 155 | back_cavity_width = 68.0; |
paul@4 | 156 | back_cavity_inner_width = 65.0; |
paul@40 | 157 | back_cavity_offset_from_inner_left = 9.0; |
paul@40 | 158 | back_cavity_inner_offset_from_inner_left = 10.5; |
paul@4 | 159 | back_cavity_height = 13.5; |
paul@4 | 160 | back_cavity_inner_height = 12.0; |
paul@4 | 161 | back_cavity_depth = 1.5; |
paul@4 | 162 | |
paul@39 | 163 | /* |
paul@40 | 164 | The effect of the cavity on the inside of the case. The most important |
paul@40 | 165 | measurement is the maximum offset since it defines the width of the |
paul@40 | 166 | internal space that should accommodate the plastic guides of the Plus 1 |
paul@40 | 167 | socket. |
paul@39 | 168 | */ |
paul@35 | 169 | |
paul@6 | 170 | inner_back_slope_depth = 2.5; |
paul@40 | 171 | inner_back_slope_width = inner_back_slope_depth; |
paul@40 | 172 | inner_back_slope_max_offset = 10.5; |
paul@40 | 173 | inner_back_slope_min_offset = inner_back_slope_max_offset - inner_back_slope_width; |
paul@5 | 174 | |
paul@40 | 175 | /* The tapering off of the inner back edge. */ |
paul@40 | 176 | |
paul@5 | 177 | inner_back_edge_width = 69.0; |
paul@5 | 178 | inner_back_edge_height = 3.0; |
paul@5 | 179 | inner_back_edge_depth = 1.5; |
paul@5 | 180 | |
paul@40 | 181 | /* The tapering off of the inner front edge. */ |
paul@40 | 182 | |
paul@34 | 183 | inner_front_edge_width = width - front_side * 2; |
paul@7 | 184 | inner_front_edge_height = 3.0; |
paul@7 | 185 | inner_front_edge_depth = 1.5; |
paul@7 | 186 | |
paul@39 | 187 | /* |
paul@39 | 188 | The cutouts in the floor of the front of the cartridge that produce a |
paul@39 | 189 | kind of tab that guides the edge connector into place in the back cutout. |
paul@39 | 190 | */ |
paul@39 | 191 | |
paul@8 | 192 | edge_connector_cutout_front_offset = 1.0; |
paul@8 | 193 | edge_connector_cutout_front_depth = 1.0; |
paul@8 | 194 | edge_connector_cutout_front_width = 15.0; |
paul@39 | 195 | |
paul@39 | 196 | /* |
paul@39 | 197 | The cutout in the floor of the back of the cartridge that accommodates |
paul@39 | 198 | the edge connector. |
paul@39 | 199 | */ |
paul@39 | 200 | |
paul@8 | 201 | edge_connector_cutout_back_depth = 3.0; |
paul@23 | 202 | edge_connector_cutout_back_width = 57.5; |
paul@8 | 203 | |
paul@17 | 204 | /* |
paul@17 | 205 | Edge connectors are themselves 0.05" or approximately 1.27mm in |
paul@17 | 206 | thickness according to the Acorn Electron Cartridge Interface Specification |
paul@17 | 207 | (Acorn Support Application Group Note 014). |
paul@17 | 208 | */ |
paul@17 | 209 | |
paul@33 | 210 | /* Extra internal features. Depths include front and back surfaces. */ |
paul@14 | 211 | |
paul@23 | 212 | pcb_back_support_width = 1.2; |
paul@14 | 213 | pcb_back_support_depth = back_depth - |
paul@14 | 214 | edge_connector_cutout_back_depth; |
paul@38 | 215 | pcb_back_support_height = height - int_connector_height - top - bottom; |
paul@14 | 216 | |
paul@23 | 217 | pcb_front_support_width = 1.2; |
paul@15 | 218 | pcb_front_support_depth = front_depth; |
paul@15 | 219 | pcb_front_support_height = pcb_back_support_height; |
paul@15 | 220 | |
paul@16 | 221 | /* |
paul@22 | 222 | Features measured from the Stardot Dual ROM Adaptor cartridge board |
paul@37 | 223 | dimensions diagram. Offsets are from inside the bottom "floor". |
paul@16 | 224 | */ |
paul@16 | 225 | |
paul@16 | 226 | pcb_back_support_bump_width = pcb_front_support_width; |
paul@18 | 227 | pcb_back_support_bump_depth = 1.5; |
paul@23 | 228 | pcb_back_support_left_bump_height = 13.2; |
paul@23 | 229 | pcb_back_support_right_bump_height = 10.7; |
paul@23 | 230 | pcb_back_support_left_bump_offset_from_bottom = 15.1; |
paul@23 | 231 | pcb_back_support_right_bump_offset_from_bottom = 17.6; |
paul@27 | 232 | pcb_back_support_top_bump_height = 3.8; |
paul@16 | 233 | |
paul@24 | 234 | /* Move the PCB support towards the centre. */ |
paul@35 | 235 | pcb_support_margin = 1.75; |
paul@37 | 236 | pcb_support_offset_from_centre = edge_connector_cutout_back_width / 2 |
paul@37 | 237 | - pcb_support_margin; |
paul@24 | 238 | |
paul@25 | 239 | pcb_lug_depth = pcb_back_support_depth + |
paul@25 | 240 | pcb_back_support_bump_depth; |
paul@25 | 241 | pcb_lug_inner_radius = 1.0; |
paul@25 | 242 | pcb_lug_outer_radius = 5.5 / 2; |
paul@25 | 243 | pcb_lug_offset_from_bottom = 14.35; |
paul@25 | 244 | pcb_lug_offset_from_outside = 7.55; |
paul@25 | 245 | |
paul@25 | 246 | pcb_lug_cross_width = 6.7; |
paul@33 | 247 | pcb_lug_cross_depth = pcb_back_support_depth; |
paul@25 | 248 | pcb_lug_cross_height = 1.4; |
paul@25 | 249 | |
paul@33 | 250 | pcb_front_lug_depth = pcb_back_support_bump_depth + |
paul@33 | 251 | pcb_front_support_depth - front; |
paul@33 | 252 | pcb_front_lug_inner_radius = pcb_lug_outer_radius; |
paul@33 | 253 | pcb_front_lug_outer_radius = pow( |
paul@33 | 254 | pow(pcb_lug_cross_width / 2, 2) + |
paul@33 | 255 | pow(pcb_lug_cross_height / 2, 2), |
paul@33 | 256 | 0.5); |
paul@33 | 257 | |
paul@25 | 258 | /* Repeated constructs. */ |
paul@25 | 259 | |
paul@26 | 260 | module pcb_support(xdir, bump_height, bump_offset) { |
paul@35 | 261 | |
paul@35 | 262 | /* |
paul@35 | 263 | Translate the support in the stated direction. |
paul@35 | 264 | Since the support is already justified in the direction, the translation |
paul@35 | 265 | moves the inner edge of the support to alignment with the end of the |
paul@35 | 266 | edge connector cutout and then back by the PCB support margin. |
paul@35 | 267 | */ |
paul@35 | 268 | |
paul@25 | 269 | translate([xdir * |
paul@37 | 270 | pcb_support_offset_from_centre, |
paul@25 | 271 | edge_connector_cutout_back_depth, |
paul@38 | 272 | -height / 2 + bottom + int_connector_height]) |
paul@25 | 273 | justify(pcb_back_support_width, |
paul@25 | 274 | pcb_back_support_depth, |
paul@25 | 275 | pcb_back_support_height, |
paul@25 | 276 | xdir, 1, 1) |
paul@25 | 277 | union() { |
paul@27 | 278 | |
paul@27 | 279 | /* Underlying support strut. */ |
paul@27 | 280 | |
paul@25 | 281 | cube([pcb_back_support_width, |
paul@25 | 282 | pcb_back_support_depth, |
paul@25 | 283 | pcb_back_support_height], center = true); |
paul@27 | 284 | |
paul@27 | 285 | /* Middle bump. */ |
paul@27 | 286 | |
paul@25 | 287 | cube_at(pcb_back_support_bump_width, |
paul@25 | 288 | pcb_back_support_bump_depth, |
paul@26 | 289 | bump_height, |
paul@25 | 290 | 0, -1, 1, |
paul@25 | 291 | 0, |
paul@25 | 292 | -pcb_back_support_depth / 2, |
paul@26 | 293 | -pcb_back_support_height / 2 + bump_offset); |
paul@27 | 294 | |
paul@27 | 295 | /* Top bump. */ |
paul@27 | 296 | |
paul@27 | 297 | cube_at(pcb_back_support_bump_width, |
paul@27 | 298 | pcb_back_support_bump_depth, |
paul@27 | 299 | pcb_back_support_top_bump_height, |
paul@27 | 300 | 0, -1, 1, |
paul@27 | 301 | 0, |
paul@27 | 302 | -pcb_back_support_depth / 2, |
paul@27 | 303 | pcb_back_support_height / 2 - |
paul@27 | 304 | pcb_back_support_top_bump_height); |
paul@25 | 305 | } |
paul@25 | 306 | } |
paul@25 | 307 | |
paul@25 | 308 | module pcb_lug(xdir) { |
paul@25 | 309 | translate([xdir * |
paul@25 | 310 | (width/2 - pcb_lug_offset_from_outside), |
paul@25 | 311 | back_depth, |
paul@38 | 312 | -height / 2 + bottom + int_connector_height + |
paul@25 | 313 | pcb_lug_offset_from_bottom |
paul@25 | 314 | ]) |
paul@25 | 315 | rotate([90, 0, 0]) |
paul@25 | 316 | difference() { |
paul@25 | 317 | union() { |
paul@25 | 318 | cylinder(h=pcb_lug_depth, r=pcb_lug_outer_radius); |
paul@25 | 319 | cube_at(pcb_lug_cross_width, |
paul@25 | 320 | pcb_lug_cross_height, pcb_lug_cross_depth, |
paul@25 | 321 | 0, 0, 1, |
paul@25 | 322 | 0, 0, 0); |
paul@25 | 323 | cube_at(pcb_lug_cross_height, |
paul@25 | 324 | pcb_lug_cross_width, pcb_lug_cross_depth, |
paul@25 | 325 | 0, 0, 1, |
paul@25 | 326 | 0, 0, 0); |
paul@25 | 327 | } |
paul@25 | 328 | cylinder(h=pcb_lug_depth, r=pcb_lug_inner_radius); |
paul@25 | 329 | } |
paul@25 | 330 | } |
paul@25 | 331 | |
paul@33 | 332 | module pcb_front_lug(xdir) { |
paul@33 | 333 | translate([xdir * |
paul@33 | 334 | (width/2 - pcb_lug_offset_from_outside), |
paul@39 | 335 | -int_front_depth + pcb_front_lug_depth, |
paul@38 | 336 | -height / 2 + bottom + int_connector_height + |
paul@33 | 337 | pcb_lug_offset_from_bottom |
paul@33 | 338 | ]) |
paul@33 | 339 | rotate([90, 0, 0]) |
paul@33 | 340 | difference() { |
paul@33 | 341 | cylinder(h=pcb_front_lug_depth, |
paul@33 | 342 | r=pcb_front_lug_outer_radius); |
paul@33 | 343 | cylinder(h=pcb_front_lug_depth, |
paul@33 | 344 | r=pcb_front_lug_inner_radius); |
paul@33 | 345 | } |
paul@33 | 346 | } |
paul@33 | 347 | |
paul@25 | 348 | /* The actual shapes. */ |
paul@25 | 349 | |
paul@19 | 350 | translate([-width * 0.6, 0, 0]) |
paul@0 | 351 | difference() { |
paul@1 | 352 | |
paul@1 | 353 | /* The cartridge surfaces. */ |
paul@1 | 354 | |
paul@0 | 355 | union() { |
paul@8 | 356 | |
paul@8 | 357 | /* Front portion. */ |
paul@8 | 358 | |
paul@8 | 359 | translate([0, -front_depth + front / 2, 0]) |
paul@0 | 360 | cube([width, front, height], center = true); |
paul@8 | 361 | translate([-width / 2 + front_left / 2, -front_depth / 2, 0]) |
paul@8 | 362 | cube([front_left, front_depth, height], center = true); |
paul@8 | 363 | translate([width / 2 - front_right / 2, -front_depth / 2, 0]) |
paul@8 | 364 | cube([front_right, front_depth, height], center = true); |
paul@8 | 365 | translate([0, -front_depth / 2, height / 2 - top / 2]) |
paul@8 | 366 | cube([width, front_depth, top], center = true); |
paul@8 | 367 | difference() { |
paul@20 | 368 | |
paul@20 | 369 | /* Floor of cartridge. */ |
paul@20 | 370 | |
paul@20 | 371 | cube_at(width, front_depth, bottom, |
paul@20 | 372 | 0, -1, 1, |
paul@38 | 373 | 0, 0, -height / 2 + int_connector_height); |
paul@20 | 374 | |
paul@20 | 375 | /* Left cutout. */ |
paul@20 | 376 | |
paul@20 | 377 | cube_at(edge_connector_cutout_front_width, |
paul@20 | 378 | edge_connector_cutout_front_depth, |
paul@20 | 379 | bottom, |
paul@20 | 380 | 1, -1, 1, |
paul@20 | 381 | -width / 2 + edge_connector_cutout_front_offset, |
paul@20 | 382 | 0, |
paul@38 | 383 | -height / 2 + int_connector_height); |
paul@20 | 384 | |
paul@20 | 385 | /* Right cutout. */ |
paul@20 | 386 | |
paul@20 | 387 | cube_at(edge_connector_cutout_front_width, |
paul@20 | 388 | edge_connector_cutout_front_depth, |
paul@20 | 389 | bottom, |
paul@20 | 390 | -1, -1, 1, |
paul@20 | 391 | width / 2 - edge_connector_cutout_front_offset, |
paul@20 | 392 | 0, |
paul@38 | 393 | -height / 2 + int_connector_height); |
paul@8 | 394 | } |
paul@15 | 395 | |
paul@15 | 396 | /* PCB supports. */ |
paul@15 | 397 | |
paul@20 | 398 | cube_at(pcb_front_support_width, |
paul@20 | 399 | pcb_front_support_depth, |
paul@20 | 400 | pcb_front_support_height, |
paul@20 | 401 | 1, -1, 1, |
paul@24 | 402 | -edge_connector_cutout_back_width / 2 + |
paul@24 | 403 | pcb_support_margin, |
paul@20 | 404 | 0, |
paul@38 | 405 | -height / 2 + bottom + int_connector_height); |
paul@15 | 406 | |
paul@20 | 407 | cube_at(pcb_front_support_width, |
paul@20 | 408 | pcb_front_support_depth, |
paul@20 | 409 | pcb_front_support_height, |
paul@20 | 410 | -1, -1, 1, |
paul@24 | 411 | edge_connector_cutout_back_width / 2 - |
paul@24 | 412 | pcb_support_margin, |
paul@20 | 413 | 0, |
paul@38 | 414 | -height / 2 + bottom + int_connector_height); |
paul@33 | 415 | |
paul@33 | 416 | /* Circular "lugs" to hold PCBs in place. */ |
paul@33 | 417 | |
paul@33 | 418 | pcb_front_lug(-1); |
paul@33 | 419 | pcb_front_lug(1); |
paul@10 | 420 | } |
paul@10 | 421 | |
paul@10 | 422 | /* Label insets. */ |
paul@10 | 423 | |
paul@10 | 424 | union() { |
paul@10 | 425 | |
paul@10 | 426 | /* Front label. */ |
paul@10 | 427 | |
paul@10 | 428 | translate([-front_label_width / 2, -front_depth, |
paul@10 | 429 | front_label_offset_from_bottom - height / 2]) |
paul@10 | 430 | cube([front_label_width, front_label_depth, |
paul@10 | 431 | front_label_height]); |
paul@10 | 432 | |
paul@10 | 433 | /* Top label. */ |
paul@10 | 434 | |
paul@10 | 435 | translate([-top_label_width / 2, |
paul@10 | 436 | -front_depth + top_label_offset_from_front, |
paul@10 | 437 | height / 2 - top_label_depth]) |
paul@10 | 438 | cube([top_label_width, top_label_height, |
paul@10 | 439 | top_label_depth]); |
paul@10 | 440 | } |
paul@10 | 441 | |
paul@10 | 442 | /* Inner front edge cavity. */ |
paul@10 | 443 | |
paul@40 | 444 | translate([inner_front_edge_width / 2, -int_front_depth, -height / 2]) |
paul@10 | 445 | rotate([0, -90, 0]) |
paul@10 | 446 | linear_extrude(height = inner_front_edge_width) |
paul@10 | 447 | polygon([ |
paul@40 | 448 | [-extra, -inner_front_edge_depth], |
paul@40 | 449 | [0, -inner_front_edge_depth], |
paul@40 | 450 | [inner_front_edge_height, 0], |
paul@10 | 451 | [-extra, 0], |
paul@10 | 452 | ]); |
paul@10 | 453 | |
paul@28 | 454 | /* Inner top cutout for the top and sides of the back portion. */ |
paul@11 | 455 | |
paul@11 | 456 | translate([0, -inner_top_front_cutout_depth / 2, height / 2 - |
paul@11 | 457 | inner_top_front_cutout_offset - |
paul@29 | 458 | inner_top_front_cutout_height / 2]) |
paul@11 | 459 | cube([inner_top_front_cutout_width, |
paul@11 | 460 | inner_top_front_cutout_depth, |
paul@29 | 461 | inner_top_front_cutout_height], center = true); |
paul@11 | 462 | |
paul@28 | 463 | translate([width / 2 - inner_side_front_cutout_offset - |
paul@28 | 464 | inner_side_front_cutout_width / 2, |
paul@28 | 465 | -inner_side_front_cutout_depth / 2, |
paul@28 | 466 | -inner_top_front_cutout_offset / 2]) |
paul@28 | 467 | cube([inner_side_front_cutout_width, |
paul@28 | 468 | inner_side_front_cutout_depth, |
paul@28 | 469 | inner_side_front_cutout_height], center = true); |
paul@28 | 470 | |
paul@28 | 471 | translate([-width / 2 + inner_side_front_cutout_offset + |
paul@28 | 472 | inner_side_front_cutout_width / 2, |
paul@28 | 473 | -inner_side_front_cutout_depth / 2, |
paul@28 | 474 | -inner_top_front_cutout_offset / 2]) |
paul@28 | 475 | cube([inner_side_front_cutout_width, |
paul@28 | 476 | inner_side_front_cutout_depth, |
paul@28 | 477 | inner_side_front_cutout_height], center = true); |
paul@28 | 478 | |
paul@10 | 479 | /* Fillets to round off the edges. */ |
paul@10 | 480 | |
paul@10 | 481 | union() { |
paul@10 | 482 | |
paul@10 | 483 | /* Top left and right rounding. */ |
paul@10 | 484 | |
paul@10 | 485 | translate([-width / 2 + ro, -front_depth / 2, height / 2 - ro]) |
paul@10 | 486 | rotate([0, 0, 180]) |
paul@10 | 487 | rotate([90, 0, 0]) |
paul@10 | 488 | fillet(rr, front_depth); |
paul@10 | 489 | translate([width / 2 - ro, -front_depth / 2, height / 2 - ro]) |
paul@10 | 490 | rotate([90, 0, 0]) |
paul@10 | 491 | fillet(rr, front_depth); |
paul@10 | 492 | |
paul@10 | 493 | /* Top front rounding. */ |
paul@10 | 494 | |
paul@10 | 495 | translate([0, -front_depth + ro, height / 2 - ro]) |
paul@10 | 496 | rotate([0, 0, 180]) |
paul@10 | 497 | rotate([0, -90, 0]) |
paul@10 | 498 | fillet(rr, width); |
paul@10 | 499 | |
paul@10 | 500 | /* Edge rounding. */ |
paul@10 | 501 | |
paul@10 | 502 | translate([-width / 2 + ro, -front_depth + ro, 0]) |
paul@10 | 503 | rotate([0, 0, 180]) |
paul@10 | 504 | fillet(rr, height); |
paul@10 | 505 | translate([width / 2 - ro, -front_depth + ro, 0]) |
paul@10 | 506 | rotate([0, 0, 270]) |
paul@10 | 507 | fillet(rr, height); |
paul@10 | 508 | } |
paul@10 | 509 | } |
paul@10 | 510 | |
paul@19 | 511 | translate([width * 0.6, 0, 0]) |
paul@19 | 512 | rotate([0, 0, 180]) |
paul@10 | 513 | difference() { |
paul@10 | 514 | |
paul@10 | 515 | /* The cartridge surfaces. */ |
paul@10 | 516 | |
paul@10 | 517 | union() { |
paul@8 | 518 | |
paul@8 | 519 | /* Back portion. */ |
paul@8 | 520 | |
paul@8 | 521 | translate([0, back_depth - back / 2, 0]) |
paul@0 | 522 | cube([width, back, height], center = true); |
paul@8 | 523 | translate([-width / 2 + back_left / 2, back_depth / 2, 0]) |
paul@8 | 524 | cube([back_left, back_depth, height], center = true); |
paul@8 | 525 | translate([width / 2 - back_right / 2, back_depth / 2, 0]) |
paul@8 | 526 | cube([back_right, back_depth, height], center = true); |
paul@8 | 527 | translate([0, back_depth / 2, height / 2 - top / 2]) |
paul@8 | 528 | cube([width, back_depth, top], center = true); |
paul@8 | 529 | difference() { |
paul@20 | 530 | |
paul@20 | 531 | /* Floor of cartridge. */ |
paul@20 | 532 | |
paul@20 | 533 | cube_at(width, back_depth, bottom, |
paul@20 | 534 | 0, 1, 1, |
paul@38 | 535 | 0, 0, -height / 2 + int_connector_height); |
paul@20 | 536 | |
paul@20 | 537 | /* Edge connector cutout. */ |
paul@20 | 538 | |
paul@20 | 539 | cube_at(edge_connector_cutout_back_width, |
paul@20 | 540 | edge_connector_cutout_back_depth, |
paul@20 | 541 | bottom, |
paul@20 | 542 | 0, 1, 1, |
paul@38 | 543 | 0, 0, -height / 2 + int_connector_height); |
paul@8 | 544 | } |
paul@14 | 545 | |
paul@14 | 546 | /* PCB supports. */ |
paul@14 | 547 | |
paul@26 | 548 | pcb_support(-1, pcb_back_support_left_bump_height, |
paul@26 | 549 | pcb_back_support_left_bump_offset_from_bottom); |
paul@26 | 550 | pcb_support(1, pcb_back_support_right_bump_height, |
paul@26 | 551 | pcb_back_support_right_bump_offset_from_bottom); |
paul@14 | 552 | |
paul@25 | 553 | /* Circular "lugs" to hold PCBs in place. */ |
paul@25 | 554 | |
paul@25 | 555 | pcb_lug(-1); |
paul@25 | 556 | pcb_lug(1); |
paul@0 | 557 | } |
paul@0 | 558 | |
paul@1 | 559 | /* Label insets. */ |
paul@1 | 560 | |
paul@1 | 561 | union() { |
paul@1 | 562 | |
paul@1 | 563 | /* Top label. */ |
paul@1 | 564 | |
paul@1 | 565 | translate([-top_label_width / 2, |
paul@8 | 566 | -front_depth + top_label_offset_from_front, |
paul@1 | 567 | height / 2 - top_label_depth]) |
paul@1 | 568 | cube([top_label_width, top_label_height, |
paul@1 | 569 | top_label_depth]); |
paul@1 | 570 | } |
paul@1 | 571 | |
paul@8 | 572 | /* Top and side grooves, positioned in the back portion. */ |
paul@2 | 573 | |
paul@2 | 574 | union() { |
paul@2 | 575 | |
paul@2 | 576 | /* Left groove. */ |
paul@2 | 577 | |
paul@8 | 578 | translate([-width / 2 + groove_depth / 2, groove_width / 2, 0]) |
paul@8 | 579 | cube([groove_depth, groove_width, height], |
paul@4 | 580 | center = true); |
paul@2 | 581 | |
paul@2 | 582 | /* Right groove. */ |
paul@2 | 583 | |
paul@8 | 584 | translate([width / 2 - groove_depth / 2, groove_width / 2, 0]) |
paul@8 | 585 | cube([groove_depth, groove_width, height], |
paul@4 | 586 | center = true); |
paul@2 | 587 | |
paul@8 | 588 | /* Top grooves. */ |
paul@2 | 589 | |
paul@8 | 590 | translate([0, groove_width / 2, height / 2 - groove_depth / 2]) |
paul@8 | 591 | cube([width, groove_width, groove_depth], |
paul@8 | 592 | center = true); |
paul@8 | 593 | |
paul@8 | 594 | translate([0, top_groove_width / 2, |
paul@8 | 595 | height / 2 - top_groove_depth / 2]) |
paul@8 | 596 | cube([width, top_groove_width, top_groove_depth], |
paul@4 | 597 | center = true); |
paul@4 | 598 | } |
paul@4 | 599 | |
paul@4 | 600 | /* Back cavity. */ |
paul@4 | 601 | |
paul@4 | 602 | intersection() { |
paul@4 | 603 | |
paul@4 | 604 | /* From the bottom upwards. */ |
paul@4 | 605 | |
paul@8 | 606 | translate([0, back_depth, -height / 2]) |
paul@4 | 607 | linear_extrude(height = back_cavity_height) |
paul@40 | 608 | translate([-int_width / 2, 0, 0]) |
paul@4 | 609 | polygon([ |
paul@40 | 610 | [back_cavity_offset_from_inner_left, 0], |
paul@40 | 611 | [back_cavity_inner_offset_from_inner_left, |
paul@4 | 612 | -back_cavity_depth], |
paul@40 | 613 | [back_cavity_inner_offset_from_inner_left + |
paul@4 | 614 | back_cavity_inner_width, |
paul@4 | 615 | -back_cavity_depth], |
paul@40 | 616 | [back_cavity_offset_from_inner_left + |
paul@4 | 617 | back_cavity_width, 0] |
paul@4 | 618 | ]); |
paul@4 | 619 | |
paul@4 | 620 | /* From left to right. */ |
paul@4 | 621 | |
paul@8 | 622 | translate([back_cavity_width / 2, back_depth, -height / 2]) |
paul@4 | 623 | rotate([0, -90, 0]) |
paul@4 | 624 | linear_extrude(height = back_cavity_width) |
paul@4 | 625 | polygon([ |
paul@4 | 626 | [-extra, -back_cavity_depth], |
paul@4 | 627 | [back_cavity_inner_height, |
paul@4 | 628 | -back_cavity_depth], |
paul@4 | 629 | [back_cavity_height, 0], |
paul@4 | 630 | [-extra, 0] |
paul@4 | 631 | ]); |
paul@2 | 632 | } |
paul@2 | 633 | |
paul@5 | 634 | /* Inner back cavities. */ |
paul@5 | 635 | |
paul@40 | 636 | translate([0, int_back_depth, -height / 2]) |
paul@38 | 637 | linear_extrude(height = int_connector_height) |
paul@40 | 638 | translate([-int_width / 2, 0, 0]) |
paul@5 | 639 | polygon([ |
paul@40 | 640 | [0, 0], |
paul@40 | 641 | [inner_back_slope_max_offset, 0], |
paul@40 | 642 | [inner_back_slope_min_offset, |
paul@40 | 643 | inner_back_slope_depth], |
paul@40 | 644 | [0, inner_back_slope_depth] |
paul@5 | 645 | ]); |
paul@5 | 646 | |
paul@40 | 647 | translate([0, int_back_depth, -height / 2]) |
paul@38 | 648 | linear_extrude(height = int_connector_height) |
paul@40 | 649 | translate([int_width / 2, 0, 0]) |
paul@5 | 650 | polygon([ |
paul@40 | 651 | [0, 0], |
paul@40 | 652 | [-inner_back_slope_max_offset, 0], |
paul@40 | 653 | [-inner_back_slope_min_offset, |
paul@40 | 654 | inner_back_slope_depth], |
paul@40 | 655 | [0, inner_back_slope_depth] |
paul@5 | 656 | ]); |
paul@5 | 657 | |
paul@7 | 658 | /* Inner back edge cavity. */ |
paul@7 | 659 | |
paul@5 | 660 | translate([inner_back_edge_width / 2, |
paul@40 | 661 | int_back_depth + inner_back_edge_depth, -height / 2]) |
paul@5 | 662 | rotate([0, -90, 0]) |
paul@5 | 663 | linear_extrude(height = inner_back_edge_width) |
paul@5 | 664 | polygon([ |
paul@5 | 665 | [-extra, -inner_back_edge_depth], |
paul@5 | 666 | [inner_back_edge_height, -inner_back_edge_depth], |
paul@5 | 667 | [0, 0], |
paul@5 | 668 | [-extra, 0] |
paul@5 | 669 | ]); |
paul@5 | 670 | |
paul@1 | 671 | /* Fillets to round off the edges. */ |
paul@1 | 672 | |
paul@0 | 673 | union() { |
paul@0 | 674 | |
paul@0 | 675 | /* Top left and right rounding. */ |
paul@0 | 676 | |
paul@9 | 677 | translate([-width / 2 + ro, back_depth / 2, height / 2 - ro]) |
paul@9 | 678 | rotate([0, 0, 180]) |
paul@9 | 679 | rotate([90, 0, 0]) |
paul@9 | 680 | fillet(rr, back_depth); |
paul@9 | 681 | translate([width / 2 - ro, back_depth / 2, height / 2 - ro]) |
paul@9 | 682 | rotate([90, 0, 0]) |
paul@9 | 683 | fillet(rr, back_depth); |
paul@0 | 684 | |
paul@10 | 685 | /* Top back rounding. */ |
paul@0 | 686 | |
paul@8 | 687 | translate([0, back_depth - ro, height / 2 - ro]) |
paul@0 | 688 | rotate([0, -90, 0]) |
paul@3 | 689 | fillet(rr, width); |
paul@0 | 690 | |
paul@0 | 691 | /* Edge rounding. */ |
paul@0 | 692 | |
paul@8 | 693 | translate([width / 2 - ro, back_depth - ro, 0]) |
paul@3 | 694 | fillet(rr, height); |
paul@8 | 695 | translate([-width / 2 + ro, back_depth - ro, 0]) |
paul@0 | 696 | rotate([0, 0, 90]) |
paul@3 | 697 | fillet(rr, height); |
paul@0 | 698 | } |
paul@0 | 699 | } |
paul@0 | 700 | } |
paul@0 | 701 | |
paul@38 | 702 | cartridge(); |