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