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