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 pcb_lug_depth = pcb_back_support_depth + 182 pcb_back_support_bump_depth; 183 pcb_lug_inner_radius = 1.0; 184 pcb_lug_outer_radius = 5.5 / 2; 185 pcb_lug_offset_from_bottom = 14.35; 186 pcb_lug_offset_from_outside = 7.55; 187 188 pcb_lug_cross_width = 6.7; 189 pcb_lug_cross_depth = pcb_lug_depth; 190 pcb_lug_cross_height = 1.4; 191 192 /* Repeated constructs. */ 193 194 module pcb_support(xdir) { 195 translate([xdir * 196 (edge_connector_cutout_back_width / 2 - pcb_support_margin), 197 edge_connector_cutout_back_depth, 198 -height / 2 + bottom + bottom_from_base]) 199 justify(pcb_back_support_width, 200 pcb_back_support_depth, 201 pcb_back_support_height, 202 xdir, 1, 1) 203 union() { 204 cube([pcb_back_support_width, 205 pcb_back_support_depth, 206 pcb_back_support_height], center = true); 207 cube_at(pcb_back_support_bump_width, 208 pcb_back_support_bump_depth, 209 pcb_back_support_left_bump_height, 210 0, -1, 1, 211 0, 212 -pcb_back_support_depth / 2, 213 -pcb_back_support_height / 2 + 214 pcb_back_support_left_bump_offset_from_bottom); 215 } 216 } 217 218 module pcb_lug(xdir) { 219 translate([xdir * 220 (width/2 - pcb_lug_offset_from_outside), 221 back_depth, 222 -height / 2 + bottom + bottom_from_base + 223 pcb_lug_offset_from_bottom 224 ]) 225 rotate([90, 0, 0]) 226 difference() { 227 union() { 228 cylinder(h=pcb_lug_depth, r=pcb_lug_outer_radius); 229 cube_at(pcb_lug_cross_width, 230 pcb_lug_cross_height, pcb_lug_cross_depth, 231 0, 0, 1, 232 0, 0, 0); 233 cube_at(pcb_lug_cross_height, 234 pcb_lug_cross_width, pcb_lug_cross_depth, 235 0, 0, 1, 236 0, 0, 0); 237 } 238 cylinder(h=pcb_lug_depth, r=pcb_lug_inner_radius); 239 } 240 } 241 242 /* The actual shapes. */ 243 244 translate([-width * 0.6, 0, 0]) 245 difference() { 246 247 /* The cartridge surfaces. */ 248 249 union() { 250 251 /* Front portion. */ 252 253 translate([0, -front_depth + front / 2, 0]) 254 cube([width, front, height], center = true); 255 translate([-width / 2 + front_left / 2, -front_depth / 2, 0]) 256 cube([front_left, front_depth, height], center = true); 257 translate([width / 2 - front_right / 2, -front_depth / 2, 0]) 258 cube([front_right, front_depth, height], center = true); 259 translate([0, -front_depth / 2, height / 2 - top / 2]) 260 cube([width, front_depth, top], center = true); 261 difference() { 262 263 /* Floor of cartridge. */ 264 265 cube_at(width, front_depth, bottom, 266 0, -1, 1, 267 0, 0, -height / 2 + bottom_from_base); 268 269 /* Left cutout. */ 270 271 cube_at(edge_connector_cutout_front_width, 272 edge_connector_cutout_front_depth, 273 bottom, 274 1, -1, 1, 275 -width / 2 + edge_connector_cutout_front_offset, 276 0, 277 -height / 2 + bottom_from_base); 278 279 /* Right cutout. */ 280 281 cube_at(edge_connector_cutout_front_width, 282 edge_connector_cutout_front_depth, 283 bottom, 284 -1, -1, 1, 285 width / 2 - edge_connector_cutout_front_offset, 286 0, 287 -height / 2 + bottom_from_base); 288 } 289 290 /* PCB supports. */ 291 292 cube_at(pcb_front_support_width, 293 pcb_front_support_depth, 294 pcb_front_support_height, 295 1, -1, 1, 296 -edge_connector_cutout_back_width / 2 + 297 pcb_support_margin, 298 0, 299 -height / 2 + bottom + bottom_from_base); 300 301 cube_at(pcb_front_support_width, 302 pcb_front_support_depth, 303 pcb_front_support_height, 304 -1, -1, 1, 305 edge_connector_cutout_back_width / 2 - 306 pcb_support_margin, 307 0, 308 -height / 2 + bottom + bottom_from_base); 309 } 310 311 /* Label insets. */ 312 313 union() { 314 315 /* Front label. */ 316 317 translate([-front_label_width / 2, -front_depth, 318 front_label_offset_from_bottom - height / 2]) 319 cube([front_label_width, front_label_depth, 320 front_label_height]); 321 322 /* Top label. */ 323 324 translate([-top_label_width / 2, 325 -front_depth + top_label_offset_from_front, 326 height / 2 - top_label_depth]) 327 cube([top_label_width, top_label_height, 328 top_label_depth]); 329 } 330 331 /* Inner front edge cavity. */ 332 333 translate([inner_front_edge_width / 2, 334 -front_depth + inner_front_edge_offset, -height / 2]) 335 rotate([0, -90, 0]) 336 linear_extrude(height = inner_front_edge_width) 337 polygon([ 338 [-extra, 0], 339 [0, 0], 340 [inner_front_edge_height, inner_front_edge_depth], 341 [-extra, inner_front_edge_depth], 342 ]); 343 344 /* Inner top cutout for the top of the back portion. */ 345 346 translate([0, -inner_top_front_cutout_depth / 2, height / 2 - 347 inner_top_front_cutout_offset - 348 inner_top_front_cutout_depth / 2]) 349 cube([inner_top_front_cutout_width, 350 inner_top_front_cutout_depth, 351 inner_top_front_cutout_depth], center = true); 352 353 /* Fillets to round off the edges. */ 354 355 union() { 356 357 /* Top left and right rounding. */ 358 359 translate([-width / 2 + ro, -front_depth / 2, height / 2 - ro]) 360 rotate([0, 0, 180]) 361 rotate([90, 0, 0]) 362 fillet(rr, front_depth); 363 translate([width / 2 - ro, -front_depth / 2, height / 2 - ro]) 364 rotate([90, 0, 0]) 365 fillet(rr, front_depth); 366 367 /* Top front rounding. */ 368 369 translate([0, -front_depth + ro, height / 2 - ro]) 370 rotate([0, 0, 180]) 371 rotate([0, -90, 0]) 372 fillet(rr, width); 373 374 /* Edge rounding. */ 375 376 translate([-width / 2 + ro, -front_depth + ro, 0]) 377 rotate([0, 0, 180]) 378 fillet(rr, height); 379 translate([width / 2 - ro, -front_depth + ro, 0]) 380 rotate([0, 0, 270]) 381 fillet(rr, height); 382 } 383 } 384 385 translate([width * 0.6, 0, 0]) 386 rotate([0, 0, 180]) 387 difference() { 388 389 /* The cartridge surfaces. */ 390 391 union() { 392 393 /* Back portion. */ 394 395 translate([0, back_depth - back / 2, 0]) 396 cube([width, back, height], center = true); 397 translate([-width / 2 + back_left / 2, back_depth / 2, 0]) 398 cube([back_left, back_depth, height], center = true); 399 translate([width / 2 - back_right / 2, back_depth / 2, 0]) 400 cube([back_right, back_depth, height], center = true); 401 translate([0, back_depth / 2, height / 2 - top / 2]) 402 cube([width, back_depth, top], center = true); 403 difference() { 404 405 /* Floor of cartridge. */ 406 407 cube_at(width, back_depth, bottom, 408 0, 1, 1, 409 0, 0, -height / 2 + bottom_from_base); 410 411 /* Edge connector cutout. */ 412 413 cube_at(edge_connector_cutout_back_width, 414 edge_connector_cutout_back_depth, 415 bottom, 416 0, 1, 1, 417 0, 0, -height / 2 + bottom_from_base); 418 } 419 420 /* PCB supports. */ 421 422 pcb_support(-1); 423 pcb_support(1); 424 425 /* Circular "lugs" to hold PCBs in place. */ 426 427 pcb_lug(-1); 428 pcb_lug(1); 429 } 430 431 /* Label insets. */ 432 433 union() { 434 435 /* Top label. */ 436 437 translate([-top_label_width / 2, 438 -front_depth + top_label_offset_from_front, 439 height / 2 - top_label_depth]) 440 cube([top_label_width, top_label_height, 441 top_label_depth]); 442 } 443 444 /* Top and side grooves, positioned in the back portion. */ 445 446 union() { 447 448 /* Left groove. */ 449 450 translate([-width / 2 + groove_depth / 2, groove_width / 2, 0]) 451 cube([groove_depth, groove_width, height], 452 center = true); 453 454 /* Right groove. */ 455 456 translate([width / 2 - groove_depth / 2, groove_width / 2, 0]) 457 cube([groove_depth, groove_width, height], 458 center = true); 459 460 /* Top grooves. */ 461 462 translate([0, groove_width / 2, height / 2 - groove_depth / 2]) 463 cube([width, groove_width, groove_depth], 464 center = true); 465 466 translate([0, top_groove_width / 2, 467 height / 2 - top_groove_depth / 2]) 468 cube([width, top_groove_width, top_groove_depth], 469 center = true); 470 } 471 472 /* Back cavity. */ 473 474 intersection() { 475 476 /* From the bottom upwards. */ 477 478 translate([0, back_depth, -height / 2]) 479 linear_extrude(height = back_cavity_height) 480 translate([-width / 2, 0, 0]) 481 polygon([ 482 [back_cavity_offset_from_left, 0], 483 [back_cavity_inner_offset_from_left, 484 -back_cavity_depth], 485 [back_cavity_inner_offset_from_left + 486 back_cavity_inner_width, 487 -back_cavity_depth], 488 [back_cavity_offset_from_left + 489 back_cavity_width, 0] 490 ]); 491 492 /* From left to right. */ 493 494 translate([back_cavity_width / 2, back_depth, -height / 2]) 495 rotate([0, -90, 0]) 496 linear_extrude(height = back_cavity_width) 497 polygon([ 498 [-extra, -back_cavity_depth], 499 [back_cavity_inner_height, 500 -back_cavity_depth], 501 [back_cavity_height, 0], 502 [-extra, 0] 503 ]); 504 } 505 506 /* Inner back cavities. */ 507 508 translate([0, back_depth - inner_back_cavity_offset, -height / 2]) 509 linear_extrude(height = bottom_from_base) 510 translate([-width / 2, 0, 0]) 511 polygon([ 512 [inner_back_cavity_offset_from_left, 0], 513 [inner_back_slope_offset_from_left, 0], 514 [inner_back_slope_offset_from_left + 515 inner_back_slope_width, 516 -inner_back_slope_depth], 517 [inner_back_cavity_offset_from_left, 518 -inner_back_slope_depth] 519 ]); 520 521 translate([0, back_depth - inner_back_cavity_offset, -height / 2]) 522 linear_extrude(height = bottom_from_base) 523 translate([-width / 2, 0, 0]) 524 polygon([ 525 [width - inner_back_slope_offset_from_left, 0], 526 [width - inner_back_cavity_offset_from_left, 0], 527 [width - inner_back_cavity_offset_from_left, 528 -inner_back_slope_depth], 529 [width - inner_back_slope_offset_from_left - 530 inner_back_slope_width, 531 -inner_back_slope_depth] 532 ]); 533 534 /* Inner back edge cavity. */ 535 536 translate([inner_back_edge_width / 2, 537 back_depth - inner_back_edge_offset, -height / 2]) 538 rotate([0, -90, 0]) 539 linear_extrude(height = inner_back_edge_width) 540 polygon([ 541 [-extra, -inner_back_edge_depth], 542 [inner_back_edge_height, -inner_back_edge_depth], 543 [0, 0], 544 [-extra, 0] 545 ]); 546 547 /* Fillets to round off the edges. */ 548 549 union() { 550 551 /* Top left and right rounding. */ 552 553 translate([-width / 2 + ro, back_depth / 2, height / 2 - ro]) 554 rotate([0, 0, 180]) 555 rotate([90, 0, 0]) 556 fillet(rr, back_depth); 557 translate([width / 2 - ro, back_depth / 2, height / 2 - ro]) 558 rotate([90, 0, 0]) 559 fillet(rr, back_depth); 560 561 /* Top back rounding. */ 562 563 translate([0, back_depth - ro, height / 2 - ro]) 564 rotate([0, -90, 0]) 565 fillet(rr, width); 566 567 /* Edge rounding. */ 568 569 translate([width / 2 - ro, back_depth - ro, 0]) 570 fillet(rr, height); 571 translate([-width / 2 + ro, back_depth - ro, 0]) 572 rotate([0, 0, 90]) 573 fillet(rr, height); 574 } 575 } 576 } 577 578 cartridge(); 579