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@38 | 88 | /* Division of pieces into front and back. */ |
paul@38 | 89 | |
paul@38 | 90 | front_depth = 6.5; |
paul@38 | 91 | |
paul@38 | 92 | /* Cartridge dimensions. */ |
paul@38 | 93 | |
paul@38 | 94 | width = int_width + side + side; |
paul@38 | 95 | height = int_payload_height + int_connector_height + top; |
paul@38 | 96 | depth = int_depth + front + back; |
paul@38 | 97 | back_depth = depth - front_depth + groove_width_extra; |
paul@38 | 98 | |
paul@38 | 99 | /* Cartridge surfaces. */ |
paul@38 | 100 | |
paul@34 | 101 | front_side = side; |
paul@29 | 102 | front_left = front_side; |
paul@29 | 103 | front_right = front_side; |
paul@34 | 104 | back_side = side; |
paul@29 | 105 | back_left = back_side; |
paul@29 | 106 | back_right = back_side; |
paul@36 | 107 | bottom = 1; |
paul@24 | 108 | |
paul@20 | 109 | /* Label details. */ |
paul@1 | 110 | |
paul@1 | 111 | front_label_width = 83.0; |
paul@1 | 112 | front_label_height = 46.0; |
paul@1 | 113 | front_label_depth = 1.0; |
paul@1 | 114 | front_label_offset_from_bottom = 19.5; |
paul@3 | 115 | |
paul@1 | 116 | top_label_width = front_label_width; |
paul@20 | 117 | top_label_height = 11.5; /* the height as seen from above */ |
paul@1 | 118 | top_label_depth = front_label_depth; |
paul@1 | 119 | top_label_offset_from_front = 2.5; |
paul@3 | 120 | |
paul@20 | 121 | /* The groove around the sides and top. */ |
paul@20 | 122 | |
paul@30 | 123 | groove_width_exposed = 1.5; |
paul@30 | 124 | groove_width = groove_width_exposed + groove_width_extra; |
paul@8 | 125 | groove_depth = 1.0; /* how deep the groove goes into each side */ |
paul@20 | 126 | |
paul@20 | 127 | /* Additional cutting to mate the back and front. */ |
paul@20 | 128 | |
paul@31 | 129 | top_groove_width = groove_width_extra; |
paul@8 | 130 | top_groove_depth = 2.0; |
paul@20 | 131 | |
paul@29 | 132 | /* |
paul@29 | 133 | Space for the inner edge of the back inside the front. |
paul@29 | 134 | Offsets are measured from the outside surfaces. |
paul@29 | 135 | */ |
paul@20 | 136 | |
paul@28 | 137 | inner_top_front_cutout_width = width - back_left - back_right; |
paul@30 | 138 | inner_top_front_cutout_depth = top_groove_width; |
paul@30 | 139 | inner_top_front_cutout_height = top - top_groove_depth; |
paul@30 | 140 | inner_top_front_cutout_offset = top_groove_depth; |
paul@28 | 141 | |
paul@28 | 142 | inner_side_front_cutout_height = height - inner_top_front_cutout_offset; |
paul@30 | 143 | inner_side_front_cutout_width = front_side - groove_depth; |
paul@30 | 144 | inner_side_front_cutout_depth = groove_width_extra; |
paul@30 | 145 | inner_side_front_cutout_offset = groove_depth; |
paul@1 | 146 | |
paul@35 | 147 | /* |
paul@35 | 148 | The back cavity is the indented part at the bottom of the back of the |
paul@35 | 149 | cartridge. |
paul@35 | 150 | */ |
paul@35 | 151 | |
paul@4 | 152 | back_cavity_width = 68.0; |
paul@4 | 153 | back_cavity_inner_width = 65.0; |
paul@4 | 154 | back_cavity_offset_from_left = 10.5; |
paul@4 | 155 | back_cavity_inner_offset_from_left = 12.0; |
paul@4 | 156 | back_cavity_height = 13.5; |
paul@4 | 157 | back_cavity_inner_height = 12.0; |
paul@4 | 158 | back_cavity_depth = 1.5; |
paul@4 | 159 | |
paul@35 | 160 | /* The effect of the cavity on the inside of the case. */ |
paul@35 | 161 | |
paul@6 | 162 | inner_back_cavity_offset = 1.0; |
paul@24 | 163 | inner_back_cavity_offset_from_left = back_left; |
paul@5 | 164 | inner_back_slope_offset_from_left = 10.0; |
paul@5 | 165 | inner_back_slope_width = 2.5; |
paul@6 | 166 | inner_back_slope_depth = 2.5; |
paul@5 | 167 | |
paul@5 | 168 | inner_back_edge_offset = 2.0; |
paul@5 | 169 | inner_back_edge_width = 69.0; |
paul@5 | 170 | inner_back_edge_height = 3.0; |
paul@5 | 171 | inner_back_edge_depth = 1.5; |
paul@5 | 172 | |
paul@7 | 173 | inner_front_edge_offset = 0.5; |
paul@34 | 174 | inner_front_edge_width = width - front_side * 2; |
paul@7 | 175 | inner_front_edge_height = 3.0; |
paul@7 | 176 | inner_front_edge_depth = 1.5; |
paul@7 | 177 | |
paul@8 | 178 | edge_connector_cutout_front_offset = 1.0; |
paul@8 | 179 | edge_connector_cutout_front_depth = 1.0; |
paul@8 | 180 | edge_connector_cutout_front_width = 15.0; |
paul@8 | 181 | edge_connector_cutout_back_depth = 3.0; |
paul@23 | 182 | edge_connector_cutout_back_width = 57.5; |
paul@8 | 183 | |
paul@17 | 184 | /* |
paul@17 | 185 | Edge connectors are themselves 0.05" or approximately 1.27mm in |
paul@17 | 186 | thickness according to the Acorn Electron Cartridge Interface Specification |
paul@17 | 187 | (Acorn Support Application Group Note 014). |
paul@17 | 188 | */ |
paul@17 | 189 | |
paul@33 | 190 | /* Extra internal features. Depths include front and back surfaces. */ |
paul@14 | 191 | |
paul@23 | 192 | pcb_back_support_width = 1.2; |
paul@14 | 193 | pcb_back_support_depth = back_depth - |
paul@14 | 194 | edge_connector_cutout_back_depth; |
paul@38 | 195 | pcb_back_support_height = height - int_connector_height - top - bottom; |
paul@14 | 196 | |
paul@23 | 197 | pcb_front_support_width = 1.2; |
paul@15 | 198 | pcb_front_support_depth = front_depth; |
paul@15 | 199 | pcb_front_support_height = pcb_back_support_height; |
paul@15 | 200 | |
paul@16 | 201 | /* |
paul@22 | 202 | Features measured from the Stardot Dual ROM Adaptor cartridge board |
paul@37 | 203 | dimensions diagram. Offsets are from inside the bottom "floor". |
paul@16 | 204 | */ |
paul@16 | 205 | |
paul@16 | 206 | pcb_back_support_bump_width = pcb_front_support_width; |
paul@18 | 207 | pcb_back_support_bump_depth = 1.5; |
paul@23 | 208 | pcb_back_support_left_bump_height = 13.2; |
paul@23 | 209 | pcb_back_support_right_bump_height = 10.7; |
paul@23 | 210 | pcb_back_support_left_bump_offset_from_bottom = 15.1; |
paul@23 | 211 | pcb_back_support_right_bump_offset_from_bottom = 17.6; |
paul@27 | 212 | pcb_back_support_top_bump_height = 3.8; |
paul@16 | 213 | |
paul@24 | 214 | /* Move the PCB support towards the centre. */ |
paul@35 | 215 | pcb_support_margin = 1.75; |
paul@37 | 216 | pcb_support_offset_from_centre = edge_connector_cutout_back_width / 2 |
paul@37 | 217 | - pcb_support_margin; |
paul@24 | 218 | |
paul@25 | 219 | pcb_lug_depth = pcb_back_support_depth + |
paul@25 | 220 | pcb_back_support_bump_depth; |
paul@25 | 221 | pcb_lug_inner_radius = 1.0; |
paul@25 | 222 | pcb_lug_outer_radius = 5.5 / 2; |
paul@25 | 223 | pcb_lug_offset_from_bottom = 14.35; |
paul@25 | 224 | pcb_lug_offset_from_outside = 7.55; |
paul@25 | 225 | |
paul@25 | 226 | pcb_lug_cross_width = 6.7; |
paul@33 | 227 | pcb_lug_cross_depth = pcb_back_support_depth; |
paul@25 | 228 | pcb_lug_cross_height = 1.4; |
paul@25 | 229 | |
paul@33 | 230 | pcb_front_lug_depth = pcb_back_support_bump_depth + |
paul@33 | 231 | pcb_front_support_depth - front; |
paul@33 | 232 | pcb_front_lug_inner_radius = pcb_lug_outer_radius; |
paul@33 | 233 | pcb_front_lug_outer_radius = pow( |
paul@33 | 234 | pow(pcb_lug_cross_width / 2, 2) + |
paul@33 | 235 | pow(pcb_lug_cross_height / 2, 2), |
paul@33 | 236 | 0.5); |
paul@33 | 237 | |
paul@25 | 238 | /* Repeated constructs. */ |
paul@25 | 239 | |
paul@26 | 240 | module pcb_support(xdir, bump_height, bump_offset) { |
paul@35 | 241 | |
paul@35 | 242 | /* |
paul@35 | 243 | Translate the support in the stated direction. |
paul@35 | 244 | Since the support is already justified in the direction, the translation |
paul@35 | 245 | moves the inner edge of the support to alignment with the end of the |
paul@35 | 246 | edge connector cutout and then back by the PCB support margin. |
paul@35 | 247 | */ |
paul@35 | 248 | |
paul@25 | 249 | translate([xdir * |
paul@37 | 250 | pcb_support_offset_from_centre, |
paul@25 | 251 | edge_connector_cutout_back_depth, |
paul@38 | 252 | -height / 2 + bottom + int_connector_height]) |
paul@25 | 253 | justify(pcb_back_support_width, |
paul@25 | 254 | pcb_back_support_depth, |
paul@25 | 255 | pcb_back_support_height, |
paul@25 | 256 | xdir, 1, 1) |
paul@25 | 257 | union() { |
paul@27 | 258 | |
paul@27 | 259 | /* Underlying support strut. */ |
paul@27 | 260 | |
paul@25 | 261 | cube([pcb_back_support_width, |
paul@25 | 262 | pcb_back_support_depth, |
paul@25 | 263 | pcb_back_support_height], center = true); |
paul@27 | 264 | |
paul@27 | 265 | /* Middle bump. */ |
paul@27 | 266 | |
paul@25 | 267 | cube_at(pcb_back_support_bump_width, |
paul@25 | 268 | pcb_back_support_bump_depth, |
paul@26 | 269 | bump_height, |
paul@25 | 270 | 0, -1, 1, |
paul@25 | 271 | 0, |
paul@25 | 272 | -pcb_back_support_depth / 2, |
paul@26 | 273 | -pcb_back_support_height / 2 + bump_offset); |
paul@27 | 274 | |
paul@27 | 275 | /* Top bump. */ |
paul@27 | 276 | |
paul@27 | 277 | cube_at(pcb_back_support_bump_width, |
paul@27 | 278 | pcb_back_support_bump_depth, |
paul@27 | 279 | pcb_back_support_top_bump_height, |
paul@27 | 280 | 0, -1, 1, |
paul@27 | 281 | 0, |
paul@27 | 282 | -pcb_back_support_depth / 2, |
paul@27 | 283 | pcb_back_support_height / 2 - |
paul@27 | 284 | pcb_back_support_top_bump_height); |
paul@25 | 285 | } |
paul@25 | 286 | } |
paul@25 | 287 | |
paul@25 | 288 | module pcb_lug(xdir) { |
paul@25 | 289 | translate([xdir * |
paul@25 | 290 | (width/2 - pcb_lug_offset_from_outside), |
paul@25 | 291 | back_depth, |
paul@38 | 292 | -height / 2 + bottom + int_connector_height + |
paul@25 | 293 | pcb_lug_offset_from_bottom |
paul@25 | 294 | ]) |
paul@25 | 295 | rotate([90, 0, 0]) |
paul@25 | 296 | difference() { |
paul@25 | 297 | union() { |
paul@25 | 298 | cylinder(h=pcb_lug_depth, r=pcb_lug_outer_radius); |
paul@25 | 299 | cube_at(pcb_lug_cross_width, |
paul@25 | 300 | pcb_lug_cross_height, pcb_lug_cross_depth, |
paul@25 | 301 | 0, 0, 1, |
paul@25 | 302 | 0, 0, 0); |
paul@25 | 303 | cube_at(pcb_lug_cross_height, |
paul@25 | 304 | pcb_lug_cross_width, pcb_lug_cross_depth, |
paul@25 | 305 | 0, 0, 1, |
paul@25 | 306 | 0, 0, 0); |
paul@25 | 307 | } |
paul@25 | 308 | cylinder(h=pcb_lug_depth, r=pcb_lug_inner_radius); |
paul@25 | 309 | } |
paul@25 | 310 | } |
paul@25 | 311 | |
paul@33 | 312 | module pcb_front_lug(xdir) { |
paul@33 | 313 | translate([xdir * |
paul@33 | 314 | (width/2 - pcb_lug_offset_from_outside), |
paul@33 | 315 | -front_depth + front + pcb_front_lug_depth, |
paul@38 | 316 | -height / 2 + bottom + int_connector_height + |
paul@33 | 317 | pcb_lug_offset_from_bottom |
paul@33 | 318 | ]) |
paul@33 | 319 | rotate([90, 0, 0]) |
paul@33 | 320 | difference() { |
paul@33 | 321 | cylinder(h=pcb_front_lug_depth, |
paul@33 | 322 | r=pcb_front_lug_outer_radius); |
paul@33 | 323 | cylinder(h=pcb_front_lug_depth, |
paul@33 | 324 | r=pcb_front_lug_inner_radius); |
paul@33 | 325 | } |
paul@33 | 326 | } |
paul@33 | 327 | |
paul@25 | 328 | /* The actual shapes. */ |
paul@25 | 329 | |
paul@19 | 330 | translate([-width * 0.6, 0, 0]) |
paul@0 | 331 | difference() { |
paul@1 | 332 | |
paul@1 | 333 | /* The cartridge surfaces. */ |
paul@1 | 334 | |
paul@0 | 335 | union() { |
paul@8 | 336 | |
paul@8 | 337 | /* Front portion. */ |
paul@8 | 338 | |
paul@8 | 339 | translate([0, -front_depth + front / 2, 0]) |
paul@0 | 340 | cube([width, front, height], center = true); |
paul@8 | 341 | translate([-width / 2 + front_left / 2, -front_depth / 2, 0]) |
paul@8 | 342 | cube([front_left, front_depth, height], center = true); |
paul@8 | 343 | translate([width / 2 - front_right / 2, -front_depth / 2, 0]) |
paul@8 | 344 | cube([front_right, front_depth, height], center = true); |
paul@8 | 345 | translate([0, -front_depth / 2, height / 2 - top / 2]) |
paul@8 | 346 | cube([width, front_depth, top], center = true); |
paul@8 | 347 | difference() { |
paul@20 | 348 | |
paul@20 | 349 | /* Floor of cartridge. */ |
paul@20 | 350 | |
paul@20 | 351 | cube_at(width, front_depth, bottom, |
paul@20 | 352 | 0, -1, 1, |
paul@38 | 353 | 0, 0, -height / 2 + int_connector_height); |
paul@20 | 354 | |
paul@20 | 355 | /* Left cutout. */ |
paul@20 | 356 | |
paul@20 | 357 | cube_at(edge_connector_cutout_front_width, |
paul@20 | 358 | edge_connector_cutout_front_depth, |
paul@20 | 359 | bottom, |
paul@20 | 360 | 1, -1, 1, |
paul@20 | 361 | -width / 2 + edge_connector_cutout_front_offset, |
paul@20 | 362 | 0, |
paul@38 | 363 | -height / 2 + int_connector_height); |
paul@20 | 364 | |
paul@20 | 365 | /* Right cutout. */ |
paul@20 | 366 | |
paul@20 | 367 | cube_at(edge_connector_cutout_front_width, |
paul@20 | 368 | edge_connector_cutout_front_depth, |
paul@20 | 369 | bottom, |
paul@20 | 370 | -1, -1, 1, |
paul@20 | 371 | width / 2 - edge_connector_cutout_front_offset, |
paul@20 | 372 | 0, |
paul@38 | 373 | -height / 2 + int_connector_height); |
paul@8 | 374 | } |
paul@15 | 375 | |
paul@15 | 376 | /* PCB supports. */ |
paul@15 | 377 | |
paul@20 | 378 | cube_at(pcb_front_support_width, |
paul@20 | 379 | pcb_front_support_depth, |
paul@20 | 380 | pcb_front_support_height, |
paul@20 | 381 | 1, -1, 1, |
paul@24 | 382 | -edge_connector_cutout_back_width / 2 + |
paul@24 | 383 | pcb_support_margin, |
paul@20 | 384 | 0, |
paul@38 | 385 | -height / 2 + bottom + int_connector_height); |
paul@15 | 386 | |
paul@20 | 387 | cube_at(pcb_front_support_width, |
paul@20 | 388 | pcb_front_support_depth, |
paul@20 | 389 | pcb_front_support_height, |
paul@20 | 390 | -1, -1, 1, |
paul@24 | 391 | edge_connector_cutout_back_width / 2 - |
paul@24 | 392 | pcb_support_margin, |
paul@20 | 393 | 0, |
paul@38 | 394 | -height / 2 + bottom + int_connector_height); |
paul@33 | 395 | |
paul@33 | 396 | /* Circular "lugs" to hold PCBs in place. */ |
paul@33 | 397 | |
paul@33 | 398 | pcb_front_lug(-1); |
paul@33 | 399 | pcb_front_lug(1); |
paul@10 | 400 | } |
paul@10 | 401 | |
paul@10 | 402 | /* Label insets. */ |
paul@10 | 403 | |
paul@10 | 404 | union() { |
paul@10 | 405 | |
paul@10 | 406 | /* Front label. */ |
paul@10 | 407 | |
paul@10 | 408 | translate([-front_label_width / 2, -front_depth, |
paul@10 | 409 | front_label_offset_from_bottom - height / 2]) |
paul@10 | 410 | cube([front_label_width, front_label_depth, |
paul@10 | 411 | front_label_height]); |
paul@10 | 412 | |
paul@10 | 413 | /* Top label. */ |
paul@10 | 414 | |
paul@10 | 415 | translate([-top_label_width / 2, |
paul@10 | 416 | -front_depth + top_label_offset_from_front, |
paul@10 | 417 | height / 2 - top_label_depth]) |
paul@10 | 418 | cube([top_label_width, top_label_height, |
paul@10 | 419 | top_label_depth]); |
paul@10 | 420 | } |
paul@10 | 421 | |
paul@10 | 422 | /* Inner front edge cavity. */ |
paul@10 | 423 | |
paul@10 | 424 | translate([inner_front_edge_width / 2, |
paul@10 | 425 | -front_depth + inner_front_edge_offset, -height / 2]) |
paul@10 | 426 | rotate([0, -90, 0]) |
paul@10 | 427 | linear_extrude(height = inner_front_edge_width) |
paul@10 | 428 | polygon([ |
paul@10 | 429 | [-extra, 0], |
paul@10 | 430 | [0, 0], |
paul@10 | 431 | [inner_front_edge_height, inner_front_edge_depth], |
paul@10 | 432 | [-extra, inner_front_edge_depth], |
paul@10 | 433 | ]); |
paul@10 | 434 | |
paul@28 | 435 | /* Inner top cutout for the top and sides of the back portion. */ |
paul@11 | 436 | |
paul@11 | 437 | translate([0, -inner_top_front_cutout_depth / 2, height / 2 - |
paul@11 | 438 | inner_top_front_cutout_offset - |
paul@29 | 439 | inner_top_front_cutout_height / 2]) |
paul@11 | 440 | cube([inner_top_front_cutout_width, |
paul@11 | 441 | inner_top_front_cutout_depth, |
paul@29 | 442 | inner_top_front_cutout_height], center = true); |
paul@11 | 443 | |
paul@28 | 444 | translate([width / 2 - inner_side_front_cutout_offset - |
paul@28 | 445 | inner_side_front_cutout_width / 2, |
paul@28 | 446 | -inner_side_front_cutout_depth / 2, |
paul@28 | 447 | -inner_top_front_cutout_offset / 2]) |
paul@28 | 448 | cube([inner_side_front_cutout_width, |
paul@28 | 449 | inner_side_front_cutout_depth, |
paul@28 | 450 | inner_side_front_cutout_height], center = true); |
paul@28 | 451 | |
paul@28 | 452 | translate([-width / 2 + inner_side_front_cutout_offset + |
paul@28 | 453 | inner_side_front_cutout_width / 2, |
paul@28 | 454 | -inner_side_front_cutout_depth / 2, |
paul@28 | 455 | -inner_top_front_cutout_offset / 2]) |
paul@28 | 456 | cube([inner_side_front_cutout_width, |
paul@28 | 457 | inner_side_front_cutout_depth, |
paul@28 | 458 | inner_side_front_cutout_height], center = true); |
paul@28 | 459 | |
paul@10 | 460 | /* Fillets to round off the edges. */ |
paul@10 | 461 | |
paul@10 | 462 | union() { |
paul@10 | 463 | |
paul@10 | 464 | /* Top left and right rounding. */ |
paul@10 | 465 | |
paul@10 | 466 | translate([-width / 2 + ro, -front_depth / 2, height / 2 - ro]) |
paul@10 | 467 | rotate([0, 0, 180]) |
paul@10 | 468 | rotate([90, 0, 0]) |
paul@10 | 469 | fillet(rr, front_depth); |
paul@10 | 470 | translate([width / 2 - ro, -front_depth / 2, height / 2 - ro]) |
paul@10 | 471 | rotate([90, 0, 0]) |
paul@10 | 472 | fillet(rr, front_depth); |
paul@10 | 473 | |
paul@10 | 474 | /* Top front rounding. */ |
paul@10 | 475 | |
paul@10 | 476 | translate([0, -front_depth + ro, height / 2 - ro]) |
paul@10 | 477 | rotate([0, 0, 180]) |
paul@10 | 478 | rotate([0, -90, 0]) |
paul@10 | 479 | fillet(rr, width); |
paul@10 | 480 | |
paul@10 | 481 | /* Edge rounding. */ |
paul@10 | 482 | |
paul@10 | 483 | translate([-width / 2 + ro, -front_depth + ro, 0]) |
paul@10 | 484 | rotate([0, 0, 180]) |
paul@10 | 485 | fillet(rr, height); |
paul@10 | 486 | translate([width / 2 - ro, -front_depth + ro, 0]) |
paul@10 | 487 | rotate([0, 0, 270]) |
paul@10 | 488 | fillet(rr, height); |
paul@10 | 489 | } |
paul@10 | 490 | } |
paul@10 | 491 | |
paul@19 | 492 | translate([width * 0.6, 0, 0]) |
paul@19 | 493 | rotate([0, 0, 180]) |
paul@10 | 494 | difference() { |
paul@10 | 495 | |
paul@10 | 496 | /* The cartridge surfaces. */ |
paul@10 | 497 | |
paul@10 | 498 | union() { |
paul@8 | 499 | |
paul@8 | 500 | /* Back portion. */ |
paul@8 | 501 | |
paul@8 | 502 | translate([0, back_depth - back / 2, 0]) |
paul@0 | 503 | cube([width, back, height], center = true); |
paul@8 | 504 | translate([-width / 2 + back_left / 2, back_depth / 2, 0]) |
paul@8 | 505 | cube([back_left, back_depth, height], center = true); |
paul@8 | 506 | translate([width / 2 - back_right / 2, back_depth / 2, 0]) |
paul@8 | 507 | cube([back_right, back_depth, height], center = true); |
paul@8 | 508 | translate([0, back_depth / 2, height / 2 - top / 2]) |
paul@8 | 509 | cube([width, back_depth, top], center = true); |
paul@8 | 510 | difference() { |
paul@20 | 511 | |
paul@20 | 512 | /* Floor of cartridge. */ |
paul@20 | 513 | |
paul@20 | 514 | cube_at(width, back_depth, bottom, |
paul@20 | 515 | 0, 1, 1, |
paul@38 | 516 | 0, 0, -height / 2 + int_connector_height); |
paul@20 | 517 | |
paul@20 | 518 | /* Edge connector cutout. */ |
paul@20 | 519 | |
paul@20 | 520 | cube_at(edge_connector_cutout_back_width, |
paul@20 | 521 | edge_connector_cutout_back_depth, |
paul@20 | 522 | bottom, |
paul@20 | 523 | 0, 1, 1, |
paul@38 | 524 | 0, 0, -height / 2 + int_connector_height); |
paul@8 | 525 | } |
paul@14 | 526 | |
paul@14 | 527 | /* PCB supports. */ |
paul@14 | 528 | |
paul@26 | 529 | pcb_support(-1, pcb_back_support_left_bump_height, |
paul@26 | 530 | pcb_back_support_left_bump_offset_from_bottom); |
paul@26 | 531 | pcb_support(1, pcb_back_support_right_bump_height, |
paul@26 | 532 | pcb_back_support_right_bump_offset_from_bottom); |
paul@14 | 533 | |
paul@25 | 534 | /* Circular "lugs" to hold PCBs in place. */ |
paul@25 | 535 | |
paul@25 | 536 | pcb_lug(-1); |
paul@25 | 537 | pcb_lug(1); |
paul@0 | 538 | } |
paul@0 | 539 | |
paul@1 | 540 | /* Label insets. */ |
paul@1 | 541 | |
paul@1 | 542 | union() { |
paul@1 | 543 | |
paul@1 | 544 | /* Top label. */ |
paul@1 | 545 | |
paul@1 | 546 | translate([-top_label_width / 2, |
paul@8 | 547 | -front_depth + top_label_offset_from_front, |
paul@1 | 548 | height / 2 - top_label_depth]) |
paul@1 | 549 | cube([top_label_width, top_label_height, |
paul@1 | 550 | top_label_depth]); |
paul@1 | 551 | } |
paul@1 | 552 | |
paul@8 | 553 | /* Top and side grooves, positioned in the back portion. */ |
paul@2 | 554 | |
paul@2 | 555 | union() { |
paul@2 | 556 | |
paul@2 | 557 | /* Left groove. */ |
paul@2 | 558 | |
paul@8 | 559 | translate([-width / 2 + groove_depth / 2, groove_width / 2, 0]) |
paul@8 | 560 | cube([groove_depth, groove_width, height], |
paul@4 | 561 | center = true); |
paul@2 | 562 | |
paul@2 | 563 | /* Right groove. */ |
paul@2 | 564 | |
paul@8 | 565 | translate([width / 2 - groove_depth / 2, groove_width / 2, 0]) |
paul@8 | 566 | cube([groove_depth, groove_width, height], |
paul@4 | 567 | center = true); |
paul@2 | 568 | |
paul@8 | 569 | /* Top grooves. */ |
paul@2 | 570 | |
paul@8 | 571 | translate([0, groove_width / 2, height / 2 - groove_depth / 2]) |
paul@8 | 572 | cube([width, groove_width, groove_depth], |
paul@8 | 573 | center = true); |
paul@8 | 574 | |
paul@8 | 575 | translate([0, top_groove_width / 2, |
paul@8 | 576 | height / 2 - top_groove_depth / 2]) |
paul@8 | 577 | cube([width, top_groove_width, top_groove_depth], |
paul@4 | 578 | center = true); |
paul@4 | 579 | } |
paul@4 | 580 | |
paul@4 | 581 | /* Back cavity. */ |
paul@4 | 582 | |
paul@4 | 583 | intersection() { |
paul@4 | 584 | |
paul@4 | 585 | /* From the bottom upwards. */ |
paul@4 | 586 | |
paul@8 | 587 | translate([0, back_depth, -height / 2]) |
paul@4 | 588 | linear_extrude(height = back_cavity_height) |
paul@4 | 589 | translate([-width / 2, 0, 0]) |
paul@4 | 590 | polygon([ |
paul@4 | 591 | [back_cavity_offset_from_left, 0], |
paul@4 | 592 | [back_cavity_inner_offset_from_left, |
paul@4 | 593 | -back_cavity_depth], |
paul@4 | 594 | [back_cavity_inner_offset_from_left + |
paul@4 | 595 | back_cavity_inner_width, |
paul@4 | 596 | -back_cavity_depth], |
paul@4 | 597 | [back_cavity_offset_from_left + |
paul@4 | 598 | back_cavity_width, 0] |
paul@4 | 599 | ]); |
paul@4 | 600 | |
paul@4 | 601 | /* From left to right. */ |
paul@4 | 602 | |
paul@8 | 603 | translate([back_cavity_width / 2, back_depth, -height / 2]) |
paul@4 | 604 | rotate([0, -90, 0]) |
paul@4 | 605 | linear_extrude(height = back_cavity_width) |
paul@4 | 606 | polygon([ |
paul@4 | 607 | [-extra, -back_cavity_depth], |
paul@4 | 608 | [back_cavity_inner_height, |
paul@4 | 609 | -back_cavity_depth], |
paul@4 | 610 | [back_cavity_height, 0], |
paul@4 | 611 | [-extra, 0] |
paul@4 | 612 | ]); |
paul@2 | 613 | } |
paul@2 | 614 | |
paul@5 | 615 | /* Inner back cavities. */ |
paul@5 | 616 | |
paul@8 | 617 | translate([0, back_depth - inner_back_cavity_offset, -height / 2]) |
paul@38 | 618 | linear_extrude(height = int_connector_height) |
paul@5 | 619 | translate([-width / 2, 0, 0]) |
paul@5 | 620 | polygon([ |
paul@5 | 621 | [inner_back_cavity_offset_from_left, 0], |
paul@5 | 622 | [inner_back_slope_offset_from_left, 0], |
paul@5 | 623 | [inner_back_slope_offset_from_left + |
paul@5 | 624 | inner_back_slope_width, |
paul@5 | 625 | -inner_back_slope_depth], |
paul@5 | 626 | [inner_back_cavity_offset_from_left, |
paul@5 | 627 | -inner_back_slope_depth] |
paul@5 | 628 | ]); |
paul@5 | 629 | |
paul@8 | 630 | translate([0, back_depth - inner_back_cavity_offset, -height / 2]) |
paul@38 | 631 | linear_extrude(height = int_connector_height) |
paul@5 | 632 | translate([-width / 2, 0, 0]) |
paul@5 | 633 | polygon([ |
paul@5 | 634 | [width - inner_back_slope_offset_from_left, 0], |
paul@5 | 635 | [width - inner_back_cavity_offset_from_left, 0], |
paul@5 | 636 | [width - inner_back_cavity_offset_from_left, |
paul@5 | 637 | -inner_back_slope_depth], |
paul@5 | 638 | [width - inner_back_slope_offset_from_left - |
paul@5 | 639 | inner_back_slope_width, |
paul@5 | 640 | -inner_back_slope_depth] |
paul@5 | 641 | ]); |
paul@5 | 642 | |
paul@7 | 643 | /* Inner back edge cavity. */ |
paul@7 | 644 | |
paul@5 | 645 | translate([inner_back_edge_width / 2, |
paul@8 | 646 | back_depth - inner_back_edge_offset, -height / 2]) |
paul@5 | 647 | rotate([0, -90, 0]) |
paul@5 | 648 | linear_extrude(height = inner_back_edge_width) |
paul@5 | 649 | polygon([ |
paul@5 | 650 | [-extra, -inner_back_edge_depth], |
paul@5 | 651 | [inner_back_edge_height, -inner_back_edge_depth], |
paul@5 | 652 | [0, 0], |
paul@5 | 653 | [-extra, 0] |
paul@5 | 654 | ]); |
paul@5 | 655 | |
paul@1 | 656 | /* Fillets to round off the edges. */ |
paul@1 | 657 | |
paul@0 | 658 | union() { |
paul@0 | 659 | |
paul@0 | 660 | /* Top left and right rounding. */ |
paul@0 | 661 | |
paul@9 | 662 | translate([-width / 2 + ro, back_depth / 2, height / 2 - ro]) |
paul@9 | 663 | rotate([0, 0, 180]) |
paul@9 | 664 | rotate([90, 0, 0]) |
paul@9 | 665 | fillet(rr, back_depth); |
paul@9 | 666 | translate([width / 2 - ro, back_depth / 2, height / 2 - ro]) |
paul@9 | 667 | rotate([90, 0, 0]) |
paul@9 | 668 | fillet(rr, back_depth); |
paul@0 | 669 | |
paul@10 | 670 | /* Top back rounding. */ |
paul@0 | 671 | |
paul@8 | 672 | translate([0, back_depth - ro, height / 2 - ro]) |
paul@0 | 673 | rotate([0, -90, 0]) |
paul@3 | 674 | fillet(rr, width); |
paul@0 | 675 | |
paul@0 | 676 | /* Edge rounding. */ |
paul@0 | 677 | |
paul@8 | 678 | translate([width / 2 - ro, back_depth - ro, 0]) |
paul@3 | 679 | fillet(rr, height); |
paul@8 | 680 | translate([-width / 2 + ro, back_depth - ro, 0]) |
paul@0 | 681 | rotate([0, 0, 90]) |
paul@3 | 682 | fillet(rr, height); |
paul@0 | 683 | } |
paul@0 | 684 | } |
paul@0 | 685 | } |
paul@0 | 686 | |
paul@38 | 687 | cartridge(); |