1 /* 2 Copyright (C) 2014 Paul Boddie 3 4 This program is free software; you can redistribute it and/or modify it under 5 the terms of the GNU General Public License as published by the Free Software 6 Foundation; either version 3 of the License, or (at your option) any later 7 version. 8 9 This program is distributed in the hope that it will be useful, but WITHOUT 10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 12 more details. 13 14 You should have received a copy of the GNU General Public License along with 15 this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 module cartridge() 19 { 20 $fn = 50; 21 22 /* 23 Rounding/fillet radius and additional margin of subtracted 24 material. The additional margin helps avoid geometry problems. 25 */ 26 27 rr = 2; 28 ro = rr; 29 extra = 0.1; 30 31 module fillet(r, h) { 32 translate([0, 0, -h/2]) 33 difference() { 34 cube([r + extra, r + extra, h + extra]); 35 cylinder(r = r, h = h); 36 } 37 } 38 39 /* 40 Justify an object of the given dimensions, according to the given 41 factors (where 1 indicates moving the object to the positive side of an 42 axis, and -1 indicates moving it to the negative side of an axis). 43 44 NOTE: child should eventually be replaced by children. 45 */ 46 module justify(width, depth, height, wdir, ddir, hdir) { 47 translate([ 48 wdir * width / 2, 49 ddir * depth / 2, 50 hdir * height / 2]) 51 child(); 52 } 53 54 /* 55 Make a cuboid of the given dimensions, justifying it according to the given 56 factors, and moving it to the specified coordinates. 57 58 NOTE: Usage of justify within this module will not work due to recursion 59 NOTE: limitations in openscad, potentially removed in more recent 60 NOTE: releases. Thus, the justify transform is merged in here. 61 */ 62 module cube_at(width, depth, height, wdir, ddir, hdir, x, y, z) { 63 translate([ 64 x + wdir * width / 2, 65 y + ddir * depth / 2, 66 z + hdir * height / 2]) 67 cube([width, depth, height], center = true); 68 } 69 70 /* Cartridge dimensions. */ 71 72 width = 90.0; 73 height = 68.3; 74 depth = 16.5; 75 front_depth = 6.5; 76 back_depth = 11.0; 77 78 /* Side thicknesses. */ 79 80 front = 2; 81 back = 3.5; 82 top = 3; 83 front_left = 1; 84 front_right = front_left; 85 back_left = 1.5; 86 back_right = back_left; 87 bottom = 2; 88 89 /* Label details. */ 90 91 front_label_width = 83.0; 92 front_label_height = 46.0; 93 front_label_depth = 1.0; 94 front_label_offset_from_bottom = 19.5; 95 96 top_label_width = front_label_width; 97 top_label_height = 11.5; /* the height as seen from above */ 98 top_label_depth = front_label_depth; 99 top_label_offset_from_front = 2.5; 100 101 /* The groove around the sides and top. */ 102 103 groove_width = 2.5; /* how much the groove cuts out of the back */ 104 groove_depth = 1.0; /* how deep the groove goes into each side */ 105 106 /* Additional cutting to mate the back and front. */ 107 108 top_groove_width = 1.0; 109 top_groove_depth = 2.0; 110 111 /* Space for the back inside the front. */ 112 113 inner_top_front_cutout_width = 87.0; 114 inner_top_front_cutout_depth = 1.0; 115 inner_top_front_cutout_offset = 2.0; 116 117 back_cavity_width = 68.0; 118 back_cavity_inner_width = 65.0; 119 back_cavity_offset_from_left = 10.5; 120 back_cavity_inner_offset_from_left = 12.0; 121 back_cavity_height = 13.5; 122 back_cavity_inner_height = 12.0; 123 back_cavity_depth = 1.5; 124 125 inner_back_cavity_offset = 1.0; 126 inner_back_cavity_offset_from_left = back_left; 127 inner_back_slope_offset_from_left = 10.0; 128 inner_back_slope_width = 2.5; 129 inner_back_slope_depth = 2.5; 130 131 inner_back_edge_offset = 2.0; 132 inner_back_edge_width = 69.0; 133 inner_back_edge_height = 3.0; 134 inner_back_edge_depth = 1.5; 135 136 inner_front_edge_offset = 0.5; 137 inner_front_edge_width = 87.0; 138 inner_front_edge_height = 3.0; 139 inner_front_edge_depth = 1.5; 140 141 bottom_from_base = 14.0; 142 143 edge_connector_cutout_front_offset = 1.0; 144 edge_connector_cutout_front_depth = 1.0; 145 edge_connector_cutout_front_width = 15.0; 146 edge_connector_cutout_back_depth = 3.0; 147 edge_connector_cutout_back_width = 57.5; 148 149 /* 150 Edge connectors are themselves 0.05" or approximately 1.27mm in 151 thickness according to the Acorn Electron Cartridge Interface Specification 152 (Acorn Support Application Group Note 014). 153 */ 154 155 /* Extra internal features. */ 156 157 pcb_back_support_width = 1.2; 158 pcb_back_support_depth = back_depth - 159 edge_connector_cutout_back_depth; 160 pcb_back_support_height = height - bottom_from_base - top - bottom; 161 162 pcb_front_support_width = 1.2; 163 pcb_front_support_depth = front_depth; 164 pcb_front_support_height = pcb_back_support_height; 165 166 /* 167 Features measured from the Stardot Dual ROM Adaptor cartridge board 168 dimensions diagram. 169 */ 170 171 pcb_back_support_bump_width = pcb_front_support_width; 172 pcb_back_support_bump_depth = 1.5; 173 pcb_back_support_left_bump_height = 13.2; 174 pcb_back_support_right_bump_height = 10.7; 175 pcb_back_support_left_bump_offset_from_bottom = 15.1; 176 pcb_back_support_right_bump_offset_from_bottom = 17.6; 177 178 /* Move the PCB support towards the centre. */ 179 pcb_support_margin = 0.55; 180 181 translate([-width * 0.6, 0, 0]) 182 difference() { 183 184 /* The cartridge surfaces. */ 185 186 union() { 187 188 /* Front portion. */ 189 190 translate([0, -front_depth + front / 2, 0]) 191 cube([width, front, height], center = true); 192 translate([-width / 2 + front_left / 2, -front_depth / 2, 0]) 193 cube([front_left, front_depth, height], center = true); 194 translate([width / 2 - front_right / 2, -front_depth / 2, 0]) 195 cube([front_right, front_depth, height], center = true); 196 translate([0, -front_depth / 2, height / 2 - top / 2]) 197 cube([width, front_depth, top], center = true); 198 difference() { 199 200 /* Floor of cartridge. */ 201 202 cube_at(width, front_depth, bottom, 203 0, -1, 1, 204 0, 0, -height / 2 + bottom_from_base); 205 206 /* Left cutout. */ 207 208 cube_at(edge_connector_cutout_front_width, 209 edge_connector_cutout_front_depth, 210 bottom, 211 1, -1, 1, 212 -width / 2 + edge_connector_cutout_front_offset, 213 0, 214 -height / 2 + bottom_from_base); 215 216 /* Right cutout. */ 217 218 cube_at(edge_connector_cutout_front_width, 219 edge_connector_cutout_front_depth, 220 bottom, 221 -1, -1, 1, 222 width / 2 - edge_connector_cutout_front_offset, 223 0, 224 -height / 2 + bottom_from_base); 225 } 226 227 /* PCB supports. */ 228 229 cube_at(pcb_front_support_width, 230 pcb_front_support_depth, 231 pcb_front_support_height, 232 1, -1, 1, 233 -edge_connector_cutout_back_width / 2 + 234 pcb_support_margin, 235 0, 236 -height / 2 + bottom + bottom_from_base); 237 238 cube_at(pcb_front_support_width, 239 pcb_front_support_depth, 240 pcb_front_support_height, 241 -1, -1, 1, 242 edge_connector_cutout_back_width / 2 - 243 pcb_support_margin, 244 0, 245 -height / 2 + bottom + bottom_from_base); 246 } 247 248 /* Label insets. */ 249 250 union() { 251 252 /* Front label. */ 253 254 translate([-front_label_width / 2, -front_depth, 255 front_label_offset_from_bottom - height / 2]) 256 cube([front_label_width, front_label_depth, 257 front_label_height]); 258 259 /* Top label. */ 260 261 translate([-top_label_width / 2, 262 -front_depth + top_label_offset_from_front, 263 height / 2 - top_label_depth]) 264 cube([top_label_width, top_label_height, 265 top_label_depth]); 266 } 267 268 /* Inner front edge cavity. */ 269 270 translate([inner_front_edge_width / 2, 271 -front_depth + inner_front_edge_offset, -height / 2]) 272 rotate([0, -90, 0]) 273 linear_extrude(height = inner_front_edge_width) 274 polygon([ 275 [-extra, 0], 276 [0, 0], 277 [inner_front_edge_height, inner_front_edge_depth], 278 [-extra, inner_front_edge_depth], 279 ]); 280 281 /* Inner top cutout for the top of the back portion. */ 282 283 translate([0, -inner_top_front_cutout_depth / 2, height / 2 - 284 inner_top_front_cutout_offset - 285 inner_top_front_cutout_depth / 2]) 286 cube([inner_top_front_cutout_width, 287 inner_top_front_cutout_depth, 288 inner_top_front_cutout_depth], center = true); 289 290 /* Fillets to round off the edges. */ 291 292 union() { 293 294 /* Top left and right rounding. */ 295 296 translate([-width / 2 + ro, -front_depth / 2, height / 2 - ro]) 297 rotate([0, 0, 180]) 298 rotate([90, 0, 0]) 299 fillet(rr, front_depth); 300 translate([width / 2 - ro, -front_depth / 2, height / 2 - ro]) 301 rotate([90, 0, 0]) 302 fillet(rr, front_depth); 303 304 /* Top front rounding. */ 305 306 translate([0, -front_depth + ro, height / 2 - ro]) 307 rotate([0, 0, 180]) 308 rotate([0, -90, 0]) 309 fillet(rr, width); 310 311 /* Edge rounding. */ 312 313 translate([-width / 2 + ro, -front_depth + ro, 0]) 314 rotate([0, 0, 180]) 315 fillet(rr, height); 316 translate([width / 2 - ro, -front_depth + ro, 0]) 317 rotate([0, 0, 270]) 318 fillet(rr, height); 319 } 320 } 321 322 translate([width * 0.6, 0, 0]) 323 rotate([0, 0, 180]) 324 difference() { 325 326 /* The cartridge surfaces. */ 327 328 union() { 329 330 /* Back portion. */ 331 332 translate([0, back_depth - back / 2, 0]) 333 cube([width, back, height], center = true); 334 translate([-width / 2 + back_left / 2, back_depth / 2, 0]) 335 cube([back_left, back_depth, height], center = true); 336 translate([width / 2 - back_right / 2, back_depth / 2, 0]) 337 cube([back_right, back_depth, height], center = true); 338 translate([0, back_depth / 2, height / 2 - top / 2]) 339 cube([width, back_depth, top], center = true); 340 difference() { 341 342 /* Floor of cartridge. */ 343 344 cube_at(width, back_depth, bottom, 345 0, 1, 1, 346 0, 0, -height / 2 + bottom_from_base); 347 348 /* Edge connector cutout. */ 349 350 cube_at(edge_connector_cutout_back_width, 351 edge_connector_cutout_back_depth, 352 bottom, 353 0, 1, 1, 354 0, 0, -height / 2 + bottom_from_base); 355 } 356 357 /* PCB supports. */ 358 359 translate([-edge_connector_cutout_back_width / 2 + 360 pcb_support_margin, 361 edge_connector_cutout_back_depth, 362 -height / 2 + bottom + bottom_from_base]) 363 justify(pcb_back_support_width, 364 pcb_back_support_depth, 365 pcb_back_support_height, 366 1, 1, 1) 367 union() { 368 cube([pcb_back_support_width, 369 pcb_back_support_depth, 370 pcb_back_support_height], center = true); 371 cube_at(pcb_back_support_bump_width, 372 pcb_back_support_bump_depth, 373 pcb_back_support_left_bump_height, 374 0, -1, 1, 375 0, 376 -pcb_back_support_depth / 2, 377 -pcb_back_support_height / 2 + 378 pcb_back_support_left_bump_offset_from_bottom); 379 } 380 381 translate([edge_connector_cutout_back_width / 2 - 382 pcb_support_margin, 383 edge_connector_cutout_back_depth, 384 -height / 2 + bottom + bottom_from_base]) 385 justify(pcb_back_support_width, 386 pcb_back_support_depth, 387 pcb_back_support_height, 388 -1, 1, 1) 389 union() { 390 cube([pcb_back_support_width, 391 pcb_back_support_depth, 392 pcb_back_support_height], center = true); 393 cube_at(pcb_back_support_bump_width, 394 pcb_back_support_bump_depth, 395 pcb_back_support_right_bump_height, 396 0, -1, 1, 397 0, 398 -pcb_back_support_depth / 2, 399 -pcb_back_support_height / 2 + 400 pcb_back_support_right_bump_offset_from_bottom); 401 } 402 } 403 404 /* Label insets. */ 405 406 union() { 407 408 /* Top label. */ 409 410 translate([-top_label_width / 2, 411 -front_depth + top_label_offset_from_front, 412 height / 2 - top_label_depth]) 413 cube([top_label_width, top_label_height, 414 top_label_depth]); 415 } 416 417 /* Top and side grooves, positioned in the back portion. */ 418 419 union() { 420 421 /* Left groove. */ 422 423 translate([-width / 2 + groove_depth / 2, groove_width / 2, 0]) 424 cube([groove_depth, groove_width, height], 425 center = true); 426 427 /* Right groove. */ 428 429 translate([width / 2 - groove_depth / 2, groove_width / 2, 0]) 430 cube([groove_depth, groove_width, height], 431 center = true); 432 433 /* Top grooves. */ 434 435 translate([0, groove_width / 2, height / 2 - groove_depth / 2]) 436 cube([width, groove_width, groove_depth], 437 center = true); 438 439 translate([0, top_groove_width / 2, 440 height / 2 - top_groove_depth / 2]) 441 cube([width, top_groove_width, top_groove_depth], 442 center = true); 443 } 444 445 /* Back cavity. */ 446 447 intersection() { 448 449 /* From the bottom upwards. */ 450 451 translate([0, back_depth, -height / 2]) 452 linear_extrude(height = back_cavity_height) 453 translate([-width / 2, 0, 0]) 454 polygon([ 455 [back_cavity_offset_from_left, 0], 456 [back_cavity_inner_offset_from_left, 457 -back_cavity_depth], 458 [back_cavity_inner_offset_from_left + 459 back_cavity_inner_width, 460 -back_cavity_depth], 461 [back_cavity_offset_from_left + 462 back_cavity_width, 0] 463 ]); 464 465 /* From left to right. */ 466 467 translate([back_cavity_width / 2, back_depth, -height / 2]) 468 rotate([0, -90, 0]) 469 linear_extrude(height = back_cavity_width) 470 polygon([ 471 [-extra, -back_cavity_depth], 472 [back_cavity_inner_height, 473 -back_cavity_depth], 474 [back_cavity_height, 0], 475 [-extra, 0] 476 ]); 477 } 478 479 /* Inner back cavities. */ 480 481 translate([0, back_depth - inner_back_cavity_offset, -height / 2]) 482 linear_extrude(height = bottom_from_base) 483 translate([-width / 2, 0, 0]) 484 polygon([ 485 [inner_back_cavity_offset_from_left, 0], 486 [inner_back_slope_offset_from_left, 0], 487 [inner_back_slope_offset_from_left + 488 inner_back_slope_width, 489 -inner_back_slope_depth], 490 [inner_back_cavity_offset_from_left, 491 -inner_back_slope_depth] 492 ]); 493 494 translate([0, back_depth - inner_back_cavity_offset, -height / 2]) 495 linear_extrude(height = bottom_from_base) 496 translate([-width / 2, 0, 0]) 497 polygon([ 498 [width - inner_back_slope_offset_from_left, 0], 499 [width - inner_back_cavity_offset_from_left, 0], 500 [width - inner_back_cavity_offset_from_left, 501 -inner_back_slope_depth], 502 [width - inner_back_slope_offset_from_left - 503 inner_back_slope_width, 504 -inner_back_slope_depth] 505 ]); 506 507 /* Inner back edge cavity. */ 508 509 translate([inner_back_edge_width / 2, 510 back_depth - inner_back_edge_offset, -height / 2]) 511 rotate([0, -90, 0]) 512 linear_extrude(height = inner_back_edge_width) 513 polygon([ 514 [-extra, -inner_back_edge_depth], 515 [inner_back_edge_height, -inner_back_edge_depth], 516 [0, 0], 517 [-extra, 0] 518 ]); 519 520 /* Fillets to round off the edges. */ 521 522 union() { 523 524 /* Top left and right rounding. */ 525 526 translate([-width / 2 + ro, back_depth / 2, height / 2 - ro]) 527 rotate([0, 0, 180]) 528 rotate([90, 0, 0]) 529 fillet(rr, back_depth); 530 translate([width / 2 - ro, back_depth / 2, height / 2 - ro]) 531 rotate([90, 0, 0]) 532 fillet(rr, back_depth); 533 534 /* Top back rounding. */ 535 536 translate([0, back_depth - ro, height / 2 - ro]) 537 rotate([0, -90, 0]) 538 fillet(rr, width); 539 540 /* Edge rounding. */ 541 542 translate([width / 2 - ro, back_depth - ro, 0]) 543 fillet(rr, height); 544 translate([-width / 2 + ro, back_depth - ro, 0]) 545 rotate([0, 0, 90]) 546 fillet(rr, height); 547 } 548 } 549 } 550 551 cartridge(); 552