1.1 --- a/cartridge.scad Sun Apr 10 16:45:18 2016 +0200
1.2 +++ b/cartridge.scad Sun Apr 10 17:45:23 2016 +0200
1.3 @@ -34,7 +34,7 @@
1.4
1.5 BACK_CONNECTOR_SECTION = 0;
1.6 FRONT_LABEL_INSET = 0; TOP_LABEL_INSET = 0;
1.7 - GROOVE = 0; ROUND_EDGES = 0; ROUND_CONNECTING_EDGES = 0
1.8 + GROOVE = 0; ROUND_EDGES = 0; ROUND_CONNECTING_EDGES = 0;
1.9
1.10 Leave all options enabled for more capable 3D printers.
1.11 */
1.12 @@ -78,6 +78,11 @@
1.13 APART = 1;
1.14 PCB = 0;
1.15
1.16 + /* To check overlaps: INTERSECT = 1; CLOSED = 1; */
1.17 +
1.18 + INTERSECT = 0;
1.19 + CLOSED = 0;
1.20 +
1.21 /* To save time (before printing): FILLET = 0; */
1.22
1.23 FILLET = 1;
1.24 @@ -587,434 +592,122 @@
1.25
1.26 /* The actual shapes. */
1.27
1.28 - front_displacement = APART ? -connector_width * 0.6 : 0;
1.29 -
1.30 - if (FRONT)
1.31 - translate([front_displacement, 0, 0])
1.32 - difference() {
1.33 -
1.34 - /* The cartridge surfaces. */
1.35 -
1.36 - union() {
1.37 -
1.38 - /* Front portion. */
1.39 -
1.40 - if (FRONT_SURFACE) {
1.41 -
1.42 - /* Surfaces surrounding the payload. */
1.43 -
1.44 - cube_at(payload_width, front, payload_height,
1.45 - 0, -1, 1,
1.46 - payload_centre, -int_front_depth, int_payload_lower_extent);
1.47 -
1.48 - cube_at(front_left, front_depth, payload_height,
1.49 - -1, -1, 1,
1.50 - int_payload_left_extent, 0, int_payload_lower_extent);
1.51 -
1.52 - cube_at(front_right, front_depth, payload_height,
1.53 - 1, -1, 1,
1.54 - int_payload_right_extent, 0, int_payload_lower_extent);
1.55 -
1.56 - /* Surfaces surrounding the connector. */
1.57 -
1.58 - cube_at(connector_width, front, connector_height,
1.59 - 0, -1, -1,
1.60 - 0, -int_front_depth, int_payload_lower_extent);
1.61 -
1.62 - cube_at(front_left, front_depth, connector_height,
1.63 - -1, -1, -1,
1.64 - -int_connector_width / 2, 0, int_payload_lower_extent);
1.65 -
1.66 - cube_at(front_right, front_depth, connector_height,
1.67 - 1, -1, -1,
1.68 - int_connector_width / 2, 0, int_payload_lower_extent);
1.69 -
1.70 - /* Top surface for the front piece. */
1.71 -
1.72 - if (TOP_SURFACE)
1.73 - cube_at(payload_width, front_depth, top,
1.74 - 0, -1, 1,
1.75 - payload_centre, 0, int_payload_upper_extent);
1.76 - }
1.77 -
1.78 - difference() {
1.79 -
1.80 - /* Floor of cartridge. */
1.81 -
1.82 - cube_at(int_connector_width, int_front_depth, bottom,
1.83 - 0, -1, 1,
1.84 - 0, 0, lower_extent + int_connector_height);
1.85 -
1.86 - /* Left cutout. */
1.87 -
1.88 - cube_at(edge_connector_cutout_front_width,
1.89 - edge_connector_cutout_front_depth,
1.90 - bottom,
1.91 - 1, -1, 1,
1.92 - -int_connector_width / 2,
1.93 - 0,
1.94 - lower_extent + int_connector_height);
1.95 -
1.96 - /* Right cutout. */
1.97 -
1.98 - cube_at(edge_connector_cutout_front_width,
1.99 - edge_connector_cutout_front_depth,
1.100 - bottom,
1.101 - -1, -1, 1,
1.102 - int_connector_width / 2,
1.103 - 0,
1.104 - lower_extent + int_connector_height);
1.105 - }
1.106 -
1.107 - /* Extended floor. */
1.108 -
1.109 - if (payload_width > connector_width) {
1.110 -
1.111 - cube_at(payload_width - connector_width, front_depth, bottom,
1.112 - 1, -1, 1,
1.113 - payload_left_extent, 0, lower_extent + int_connector_height);
1.114 - }
1.115 -
1.116 - /* PCB supports. */
1.117 -
1.118 - if (MODEL == ROM_CARTRIDGE) {
1.119 - cube_at(pcb_front_support_width,
1.120 - pcb_front_support_depth,
1.121 - pcb_front_support_height,
1.122 - -1, -1, 1,
1.123 - -pcb_support_offset_from_centre,
1.124 - 0,
1.125 - int_payload_lower_extent);
1.126 -
1.127 - cube_at(pcb_front_support_width,
1.128 - pcb_front_support_depth,
1.129 - pcb_front_support_height,
1.130 - 1, -1, 1,
1.131 - pcb_support_offset_from_centre,
1.132 - 0,
1.133 - int_payload_lower_extent);
1.134 -
1.135 - /* Circular "lugs" to hold PCBs in place. */
1.136 -
1.137 - pcb_front_lug(-1);
1.138 - pcb_front_lug(1);
1.139 - }
1.140 -
1.141 - if (MODEL == WIDE_CARTRIDGE) {
1.142 -
1.143 - pcb_front_lug_wide(-1);
1.144 - pcb_front_lug_wide(1);
1.145 - }
1.146 - }
1.147 -
1.148 - /* Label insets. */
1.149 -
1.150 - union() {
1.151 -
1.152 - /* Front label. */
1.153 -
1.154 - if (FRONT_LABEL_INSET)
1.155 - translate([front_label_left_extent, -front_depth,
1.156 - lower_extent + front_label_offset_from_bottom])
1.157 - cube([front_label_width, front_label_depth,
1.158 - front_label_height]);
1.159 -
1.160 - /* Top label. See also the back piece. */
1.161 -
1.162 - if (TOP_LABEL_INSET)
1.163 - translate([top_label_left_extent,
1.164 - -front_depth + top_label_offset_from_front,
1.165 - upper_extent - top_label_depth])
1.166 - cube([top_label_width, top_label_height,
1.167 - top_label_depth]);
1.168 - }
1.169 -
1.170 - /* Inner front edge cavity. */
1.171 -
1.172 - translate([inner_front_edge_width / 2, -int_front_depth, lower_extent])
1.173 - rotate([0, -90, 0])
1.174 - linear_extrude(height = inner_front_edge_width)
1.175 - polygon([
1.176 - [-extra, -inner_front_edge_depth],
1.177 - [0, -inner_front_edge_depth],
1.178 - [inner_front_edge_height, 0],
1.179 - [-extra, 0],
1.180 - ]);
1.181 -
1.182 - /* Inner top cutout for the top and sides of the back portion. */
1.183 -
1.184 - cube_at(inner_top_front_cutout_width,
1.185 - inner_top_front_cutout_depth,
1.186 - inner_top_front_cutout_height,
1.187 - 1, -1, 1,
1.188 - int_payload_left_extent, 0, int_payload_upper_extent);
1.189 -
1.190 - cube_at(inner_payload_front_cutout_width,
1.191 - inner_payload_front_cutout_depth,
1.192 - inner_payload_front_cutout_height,
1.193 - 1, -1, 1,
1.194 - int_payload_right_extent, 0, int_payload_lower_extent);
1.195 -
1.196 - cube_at(inner_payload_front_cutout_width,
1.197 - inner_payload_front_cutout_depth,
1.198 - inner_payload_front_cutout_height,
1.199 - -1, -1, 1,
1.200 - int_payload_left_extent, 0, int_payload_lower_extent);
1.201 -
1.202 - if (BACK_CONNECTOR_SECTION) {
1.203 -
1.204 - /* Cutout to accept the back connector sides. */
1.205 -
1.206 - cube_at(inner_connector_front_cutout_width,
1.207 - inner_connector_front_cutout_depth,
1.208 - inner_connector_front_cutout_height,
1.209 - 1, -1, -1,
1.210 - int_connector_width / 2, 0, int_payload_lower_extent);
1.211 -
1.212 - cube_at(inner_connector_front_cutout_width,
1.213 - inner_connector_front_cutout_depth,
1.214 - inner_connector_front_cutout_height,
1.215 - -1, -1, -1,
1.216 - -int_connector_width / 2, 0, int_payload_lower_extent);
1.217 - }
1.218 -
1.219 - /* Fillets to round off the edges. */
1.220 -
1.221 - union() {
1.222 - if (ROUND_EDGES) {
1.223 -
1.224 - /* Top left and right rounding. */
1.225 -
1.226 - translate([payload_left_extent + ro, -front_depth / 2, upper_extent - ro])
1.227 - rotate([0, 0, 180])
1.228 - rotate([90, 0, 0])
1.229 - fillet(rr, front_depth);
1.230 - translate([payload_right_extent - ro, -front_depth / 2, upper_extent - ro])
1.231 - rotate([90, 0, 0])
1.232 - fillet(rr, front_depth);
1.233 -
1.234 - /* Top front rounding. */
1.235 -
1.236 - translate([payload_centre, -front_depth + ro, upper_extent - ro])
1.237 - rotate([0, 0, 180])
1.238 - rotate([0, -90, 0])
1.239 - fillet(rr, payload_width);
1.240 -
1.241 - /* Edge rounding. */
1.242 -
1.243 - translate([payload_right_extent - ro, -front_depth + ro, int_payload_lower_extent - bottom - extra])
1.244 - rotate([0, 0, 270])
1.245 - fillet_justified(rr, payload_height + bottom + extra);
1.246 -
1.247 - translate([payload_left_extent + ro, -front_depth + ro, int_payload_lower_extent - bottom - extra])
1.248 - rotate([0, 0, 180])
1.249 - fillet_justified(rr, payload_height + bottom + extra);
1.250 -
1.251 - translate([connector_width / 2 - ro, -front_depth + ro, lower_extent])
1.252 - rotate([0, 0, 270])
1.253 - fillet_partitioned(rr, connector_height - bottom);
1.254 -
1.255 - translate([-connector_width / 2 + ro, -front_depth + ro, lower_extent])
1.256 - rotate([0, 0, 180])
1.257 - fillet_partitioned(rr, connector_height - bottom);
1.258 - }
1.259 - }
1.260 - }
1.261 -
1.262 - /*
1.263 - Place the back piece next to the front, with the internals facing out
1.264 - the same way, if APART is defined.
1.265 - */
1.266 -
1.267 - back_displacement = APART ? connector_width * 0.6 : 0;
1.268 - back_rotation = APART ? 180 : 0;
1.269 -
1.270 - if (BACK)
1.271 - translate([back_displacement, 0, 0])
1.272 - rotate([0, 0, back_rotation]) {
1.273 + module front_piece(front_displacement, front_displacement_together) {
1.274 + if (FRONT)
1.275 + translate([front_displacement, front_displacement_together, 0])
1.276 difference() {
1.277
1.278 /* The cartridge surfaces. */
1.279
1.280 union() {
1.281
1.282 - /* Back portion. */
1.283 + /* Front portion. */
1.284
1.285 - if (BACK_SURFACE) {
1.286 + if (FRONT_SURFACE) {
1.287
1.288 /* Surfaces surrounding the payload. */
1.289
1.290 - /* Payload section of back surface. */
1.291 + cube_at(payload_width, front, payload_height,
1.292 + 0, -1, 1,
1.293 + payload_centre, -int_front_depth, int_payload_lower_extent);
1.294
1.295 - cube_at(payload_width, payload_back, payload_height,
1.296 - 0, 1, 1,
1.297 - payload_centre, int_payload_back_depth, int_payload_lower_extent);
1.298 -
1.299 - cube_at(back_left, back_depth, payload_height,
1.300 - -1, 1, 1,
1.301 + cube_at(front_left, front_depth, payload_height,
1.302 + -1, -1, 1,
1.303 int_payload_left_extent, 0, int_payload_lower_extent);
1.304
1.305 - cube_at(back_right, back_depth, payload_height,
1.306 - 1, 1, 1,
1.307 + cube_at(front_right, front_depth, payload_height,
1.308 + 1, -1, 1,
1.309 int_payload_right_extent, 0, int_payload_lower_extent);
1.310
1.311 /* Surfaces surrounding the connector. */
1.312
1.313 - /* Connector section of back surface overlapping the floor. */
1.314 -
1.315 - if (BACK_CONNECTOR_SECTION) {
1.316 - cube_at(connector_width, connector_back, connector_height,
1.317 - 0, 1, -1,
1.318 - 0, int_connector_back_depth, int_payload_lower_extent);
1.319 + cube_at(connector_width, front, connector_height,
1.320 + 0, -1, -1,
1.321 + 0, -int_front_depth, int_payload_lower_extent);
1.322
1.323 - cube_at(back_left, back_depth, connector_height,
1.324 - -1, 1, -1,
1.325 - -int_connector_width / 2, 0, int_payload_lower_extent);
1.326 + cube_at(front_left, front_depth, connector_height,
1.327 + -1, -1, -1,
1.328 + -int_connector_width / 2, 0, int_payload_lower_extent);
1.329
1.330 - cube_at(back_right, back_depth, connector_height,
1.331 - 1, 1, -1,
1.332 - int_connector_width / 2, 0, int_payload_lower_extent);
1.333 - }
1.334 + cube_at(front_right, front_depth, connector_height,
1.335 + 1, -1, -1,
1.336 + int_connector_width / 2, 0, int_payload_lower_extent);
1.337
1.338 - /* Top of back piece. */
1.339 + /* Top surface for the front piece. */
1.340
1.341 if (TOP_SURFACE)
1.342 - cube_at(payload_width, back_depth, top,
1.343 - 0, 1, 1,
1.344 + cube_at(payload_width, front_depth, top,
1.345 + 0, -1, 1,
1.346 payload_centre, 0, int_payload_upper_extent);
1.347 -
1.348 - /*
1.349 - The extension of the back to connect with the front. Here, the inside
1.350 - edges are rounded. The outside edges are rounded later.
1.351 -
1.352 - An extra overlapping measure is employed so that the filleting is
1.353 - continuous between the payload and connector portions. On the inside
1.354 - edges, the connector filleting is extended upwards.
1.355 - */
1.356 -
1.357 - /* Left side of payload. */
1.358 -
1.359 - difference() {
1.360 - cube_at(back_left - groove_depth, groove_width_extra, inner_payload_front_cutout_height,
1.361 - -1, 1, 1,
1.362 - int_payload_left_extent, -groove_width_extra, int_payload_lower_extent);
1.363 - if (ROUND_CONNECTING_EDGES)
1.364 - translate([int_payload_left_extent - groove_ro, -groove_width_extra + groove_ro,
1.365 - int_payload_lower_extent])
1.366 - rotate([0, 0, -90])
1.367 - fillet_justified(groove_rr, inner_payload_front_cutout_height);
1.368 - }
1.369 -
1.370 - /* Right side of payload. */
1.371 -
1.372 - difference() {
1.373 - cube_at(back_right - groove_depth, groove_width_extra, inner_payload_front_cutout_height,
1.374 - 1, 1, 1,
1.375 - int_payload_right_extent, -groove_width_extra, int_payload_lower_extent);
1.376 - if (ROUND_CONNECTING_EDGES)
1.377 - translate([int_payload_right_extent + groove_ro, -groove_width_extra + groove_ro,
1.378 - int_payload_lower_extent])
1.379 - rotate([0, 0, 180])
1.380 - fillet_justified(groove_rr, inner_payload_front_cutout_height);
1.381 - }
1.382 -
1.383 - if (BACK_CONNECTOR_SECTION) {
1.384 -
1.385 - /* Left side of connector. */
1.386 -
1.387 - difference() {
1.388 - cube_at(back_left - groove_depth, groove_width_extra, inner_connector_front_cutout_height,
1.389 - -1, 1, -1,
1.390 - -int_connector_width / 2, -groove_width_extra, int_payload_lower_extent);
1.391 - if (ROUND_CONNECTING_EDGES)
1.392 - translate([-int_connector_width / 2 - groove_ro, -groove_width_extra + groove_ro,
1.393 - lower_extent])
1.394 - rotate([0, 0, -90])
1.395 - fillet_partitioned(groove_rr,
1.396 - inner_connector_front_cutout_height + extra);
1.397 - }
1.398 -
1.399 - /* Right side of connector. */
1.400 -
1.401 - difference() {
1.402 - cube_at(back_right - groove_depth, groove_width_extra, inner_connector_front_cutout_height,
1.403 - 1, 1, -1,
1.404 - int_connector_width / 2, -groove_width_extra, int_payload_lower_extent);
1.405 - if (ROUND_CONNECTING_EDGES)
1.406 - translate([int_connector_width / 2 + groove_ro, -groove_width_extra + groove_ro,
1.407 - lower_extent])
1.408 - rotate([0, 0, 180])
1.409 - fillet_partitioned(groove_rr,
1.410 - inner_connector_front_cutout_height + extra);
1.411 - }
1.412 - }
1.413 -
1.414 - /* Top side. */
1.415 -
1.416 - difference() {
1.417 - cube_at(payload_width - groove_depth * 2, groove_width_extra, top - top_groove_depth,
1.418 - 0, 1, 1,
1.419 - payload_centre, -groove_width_extra, int_payload_upper_extent);
1.420 - if (ROUND_CONNECTING_EDGES)
1.421 - translate([payload_centre, -groove_width_extra + groove_ro,
1.422 - int_payload_upper_extent + groove_ro])
1.423 - rotate([0, 0, 180])
1.424 - rotate([0, 90, 0])
1.425 - fillet(groove_rr, payload_width - groove_depth * 2);
1.426 - }
1.427 }
1.428
1.429 difference() {
1.430
1.431 /* Floor of cartridge. */
1.432
1.433 - cube_at(connector_width, back_depth, bottom,
1.434 - 0, 1, 1,
1.435 + cube_at(int_connector_width, int_front_depth, bottom,
1.436 + 0, -1, 1,
1.437 0, 0, lower_extent + int_connector_height);
1.438
1.439 - /* Edge connector cutout. */
1.440 + /* Left cutout. */
1.441 +
1.442 + cube_at(edge_connector_cutout_front_width,
1.443 + edge_connector_cutout_front_depth,
1.444 + bottom,
1.445 + 1, -1, 1,
1.446 + -int_connector_width / 2,
1.447 + 0,
1.448 + lower_extent + int_connector_height);
1.449
1.450 - cube_at(edge_connector_cutout_back_width,
1.451 - edge_connector_cutout_back_depth,
1.452 + /* Right cutout. */
1.453 +
1.454 + cube_at(edge_connector_cutout_front_width,
1.455 + edge_connector_cutout_front_depth,
1.456 bottom,
1.457 - 0, 1, 1,
1.458 - 0, 0, lower_extent + int_connector_height);
1.459 + -1, -1, 1,
1.460 + int_connector_width / 2,
1.461 + 0,
1.462 + lower_extent + int_connector_height);
1.463 }
1.464
1.465 /* Extended floor. */
1.466
1.467 if (payload_width > connector_width) {
1.468
1.469 - difference() {
1.470 -
1.471 - cube_at(payload_width - connector_width, back_depth, bottom,
1.472 - 1, 1, 1,
1.473 - payload_left_extent, 0, lower_extent + int_connector_height);
1.474 -
1.475 - cube_at(payload_width - connector_width, edge_connector_cutout_front_depth, bottom,
1.476 - 1, 1, 1,
1.477 - payload_left_extent, 0, lower_extent + int_connector_height);
1.478 - }
1.479 + cube_at(payload_width - connector_width, front_depth, bottom,
1.480 + 1, -1, 1,
1.481 + payload_left_extent, 0, lower_extent + int_connector_height);
1.482 }
1.483
1.484 /* PCB supports. */
1.485
1.486 if (MODEL == ROM_CARTRIDGE) {
1.487 - pcb_support(-1, pcb_back_support_left_bump_height,
1.488 - pcb_back_support_left_bump_offset_from_bottom);
1.489 - pcb_support(1, pcb_back_support_right_bump_height,
1.490 - pcb_back_support_right_bump_offset_from_bottom);
1.491 + cube_at(pcb_front_support_width,
1.492 + pcb_front_support_depth,
1.493 + pcb_front_support_height,
1.494 + -1, -1, 1,
1.495 + -pcb_support_offset_from_centre,
1.496 + 0,
1.497 + int_payload_lower_extent);
1.498 +
1.499 + cube_at(pcb_front_support_width,
1.500 + pcb_front_support_depth,
1.501 + pcb_front_support_height,
1.502 + 1, -1, 1,
1.503 + pcb_support_offset_from_centre,
1.504 + 0,
1.505 + int_payload_lower_extent);
1.506
1.507 /* Circular "lugs" to hold PCBs in place. */
1.508
1.509 - pcb_lug(-1);
1.510 - pcb_lug(1);
1.511 + pcb_front_lug(-1);
1.512 + pcb_front_lug(1);
1.513 }
1.514
1.515 if (MODEL == WIDE_CARTRIDGE) {
1.516
1.517 - pcb_lug_wide(1);
1.518 - pcb_lug_wide(-1);
1.519 + pcb_front_lug_wide(-1);
1.520 + pcb_front_lug_wide(1);
1.521 }
1.522 }
1.523
1.524 @@ -1022,7 +715,15 @@
1.525
1.526 union() {
1.527
1.528 - /* Top label. See also the front piece. */
1.529 + /* Front label. */
1.530 +
1.531 + if (FRONT_LABEL_INSET)
1.532 + translate([front_label_left_extent, -front_depth,
1.533 + lower_extent + front_label_offset_from_bottom])
1.534 + cube([front_label_width, front_label_depth,
1.535 + front_label_height]);
1.536 +
1.537 + /* Top label. See also the back piece. */
1.538
1.539 if (TOP_LABEL_INSET)
1.540 translate([top_label_left_extent,
1.541 @@ -1032,106 +733,53 @@
1.542 top_label_depth]);
1.543 }
1.544
1.545 - /* Top and side grooves, positioned in the back portion. */
1.546 -
1.547 - union() {
1.548 -
1.549 - /* Left groove. */
1.550 + /* Inner front edge cavity. */
1.551
1.552 - cube_at(groove_depth, groove_width_normal, height,
1.553 - 1, 1, 0,
1.554 - payload_left_extent, 0, 0);
1.555 + translate([inner_front_edge_width / 2, -int_front_depth, lower_extent])
1.556 + rotate([0, -90, 0])
1.557 + linear_extrude(height = inner_front_edge_width)
1.558 + polygon([
1.559 + [-extra, -inner_front_edge_depth],
1.560 + [0, -inner_front_edge_depth],
1.561 + [inner_front_edge_height, 0],
1.562 + [-extra, 0],
1.563 + ]);
1.564
1.565 - /* Right groove. */
1.566 + /* Inner top cutout for the top and sides of the back portion. */
1.567
1.568 - cube_at(groove_depth, groove_width_normal, height,
1.569 - -1, 1, 0,
1.570 - payload_right_extent, 0, 0);
1.571 -
1.572 - /* Top grooves. */
1.573 + cube_at(inner_top_front_cutout_width,
1.574 + inner_top_front_cutout_depth,
1.575 + inner_top_front_cutout_height,
1.576 + 1, -1, 1,
1.577 + int_payload_left_extent, 0, int_payload_upper_extent);
1.578
1.579 - cube_at(payload_width, groove_width_normal, groove_depth,
1.580 - 0, 1, -1,
1.581 - payload_centre, 0, upper_extent);
1.582 + cube_at(inner_payload_front_cutout_width,
1.583 + inner_payload_front_cutout_depth,
1.584 + inner_payload_front_cutout_height,
1.585 + 1, -1, 1,
1.586 + int_payload_right_extent, 0, int_payload_lower_extent);
1.587
1.588 - cube_at(payload_width, top_groove_width, top_groove_depth,
1.589 - 0, 1, -1,
1.590 - payload_centre, -groove_width_extra, upper_extent);
1.591 - }
1.592 + cube_at(inner_payload_front_cutout_width,
1.593 + inner_payload_front_cutout_depth,
1.594 + inner_payload_front_cutout_height,
1.595 + -1, -1, 1,
1.596 + int_payload_left_extent, 0, int_payload_lower_extent);
1.597
1.598 if (BACK_CONNECTOR_SECTION) {
1.599
1.600 - /* Back cavity. */
1.601 -
1.602 - if (BACK_CAVITY)
1.603 - intersection() {
1.604 -
1.605 - /* From the bottom upwards. */
1.606 -
1.607 - translate([0, back_depth, lower_extent])
1.608 - linear_extrude(height = back_cavity_height)
1.609 - translate([-int_connector_width / 2, 0, 0])
1.610 - polygon([
1.611 - [back_cavity_offset_from_inner_left, 0],
1.612 - [back_cavity_inner_offset_from_inner_left,
1.613 - -back_cavity_depth],
1.614 - [back_cavity_inner_offset_from_inner_left +
1.615 - back_cavity_inner_width,
1.616 - -back_cavity_depth],
1.617 - [back_cavity_offset_from_inner_left +
1.618 - back_cavity_width, 0]
1.619 - ]);
1.620 -
1.621 - /* From left to right. */
1.622 -
1.623 - translate([back_cavity_width / 2, back_depth, lower_extent])
1.624 - rotate([0, -90, 0])
1.625 - linear_extrude(height = back_cavity_width)
1.626 - polygon([
1.627 - [-extra, -back_cavity_depth],
1.628 - [back_cavity_inner_height,
1.629 - -back_cavity_depth],
1.630 - [back_cavity_height, 0],
1.631 - [-extra, 0]
1.632 - ]);
1.633 - }
1.634 + /* Cutout to accept the back connector sides. */
1.635
1.636 - /* Inner back cavities. */
1.637 -
1.638 - translate([0, int_connector_back_depth, lower_extent])
1.639 - linear_extrude(height = int_connector_height)
1.640 - translate([-int_connector_width / 2, 0, 0])
1.641 - polygon([
1.642 - [0, 0],
1.643 - [inner_back_slope_max_offset, 0],
1.644 - [inner_back_slope_min_offset,
1.645 - inner_back_slope_depth],
1.646 - [0, inner_back_slope_depth]
1.647 - ]);
1.648 + cube_at(inner_connector_front_cutout_width,
1.649 + inner_connector_front_cutout_depth,
1.650 + inner_connector_front_cutout_height,
1.651 + 1, -1, -1,
1.652 + int_connector_width / 2, 0, int_payload_lower_extent);
1.653
1.654 - translate([0, int_connector_back_depth, lower_extent])
1.655 - linear_extrude(height = int_connector_height)
1.656 - translate([int_connector_width / 2, 0, 0])
1.657 - polygon([
1.658 - [0, 0],
1.659 - [-inner_back_slope_max_offset, 0],
1.660 - [-inner_back_slope_min_offset,
1.661 - inner_back_slope_depth],
1.662 - [0, inner_back_slope_depth]
1.663 - ]);
1.664 -
1.665 - /* Inner back edge cavity. */
1.666 -
1.667 - translate([inner_back_edge_width / 2,
1.668 - int_connector_back_depth + inner_back_edge_depth, lower_extent])
1.669 - rotate([0, -90, 0])
1.670 - linear_extrude(height = inner_back_edge_width)
1.671 - polygon([
1.672 - [-extra, -inner_back_edge_depth],
1.673 - [inner_back_edge_height, -inner_back_edge_depth],
1.674 - [0, 0],
1.675 - [-extra, 0]
1.676 - ]);
1.677 + cube_at(inner_connector_front_cutout_width,
1.678 + inner_connector_front_cutout_depth,
1.679 + inner_connector_front_cutout_height,
1.680 + -1, -1, -1,
1.681 + -int_connector_width / 2, 0, int_payload_lower_extent);
1.682 }
1.683
1.684 /* Fillets to round off the edges. */
1.685 @@ -1141,214 +789,589 @@
1.686
1.687 /* Top left and right rounding. */
1.688
1.689 - translate([payload_left_extent + ro, back_depth / 2, upper_extent - ro])
1.690 + translate([payload_left_extent + ro, -front_depth / 2, upper_extent - ro])
1.691 rotate([0, 0, 180])
1.692 rotate([90, 0, 0])
1.693 - fillet(rr, back_depth);
1.694 - translate([payload_right_extent - ro, back_depth / 2, upper_extent - ro])
1.695 + fillet(rr, front_depth);
1.696 + translate([payload_right_extent - ro, -front_depth / 2, upper_extent - ro])
1.697 rotate([90, 0, 0])
1.698 - fillet(rr, back_depth);
1.699 -
1.700 - /* Top back rounding. */
1.701 + fillet(rr, front_depth);
1.702 +
1.703 + /* Top front rounding. */
1.704
1.705 - translate([payload_centre, back_depth - ro, upper_extent - ro])
1.706 - rotate([0, -90, 0])
1.707 - fillet(rr, payload_width);
1.708 + translate([payload_centre, -front_depth + ro, upper_extent - ro])
1.709 + rotate([0, 0, 180])
1.710 + rotate([0, -90, 0])
1.711 + fillet(rr, payload_width);
1.712
1.713 - /* Outer edge rounding. */
1.714 + /* Edge rounding. */
1.715
1.716 - translate([payload_right_extent - ro, back_depth - ro, int_payload_lower_extent - bottom - extra])
1.717 - fillet_justified(rr, payload_height + bottom + extra);
1.718 -
1.719 - translate([payload_left_extent + ro, back_depth - ro, int_payload_lower_extent - bottom - extra])
1.720 - rotate([0, 0, 90])
1.721 + translate([payload_right_extent - ro, -front_depth + ro, int_payload_lower_extent - bottom - extra])
1.722 + rotate([0, 0, 270])
1.723 fillet_justified(rr, payload_height + bottom + extra);
1.724
1.725 - if (BACK_CONNECTOR_SECTION) {
1.726 - translate([connector_width / 2 - ro, back_depth - ro, lower_extent])
1.727 + translate([payload_left_extent + ro, -front_depth + ro, int_payload_lower_extent - bottom - extra])
1.728 + rotate([0, 0, 180])
1.729 + fillet_justified(rr, payload_height + bottom + extra);
1.730 +
1.731 + translate([connector_width / 2 - ro, -front_depth + ro, lower_extent])
1.732 + rotate([0, 0, 270])
1.733 fillet_partitioned(rr, connector_height - bottom);
1.734
1.735 - translate([-connector_width / 2 + ro, back_depth - ro, lower_extent])
1.736 - rotate([0, 0, 90])
1.737 - fillet_partitioned(rr, connector_height - bottom);
1.738 - }
1.739 - }
1.740 -
1.741 - if (ROUND_CONNECTING_EDGES) {
1.742 -
1.743 - /*
1.744 - Outer edge rounding of the back extension. This is done as a
1.745 - separate removal operation rather than occurring when creating the
1.746 - extension in order to ensure that the edges are actually rounded.
1.747 -
1.748 - An extra overlapping measure is employed so that the filleting is
1.749 - continuous between the payload and connector portions. On the outside
1.750 - edges, the payload filleting is extended downwards.
1.751 - */
1.752 -
1.753 - translate([payload_left_extent + groove_depth + groove_ro, -groove_width_extra + groove_ro,
1.754 - int_payload_lower_extent - extra])
1.755 + translate([-connector_width / 2 + ro, -front_depth + ro, lower_extent])
1.756 rotate([0, 0, 180])
1.757 - fillet_justified(groove_rr, inner_payload_front_cutout_height + extra);
1.758 -
1.759 - translate([payload_right_extent - groove_depth - groove_ro, -groove_width_extra + groove_ro,
1.760 - int_payload_lower_extent - extra])
1.761 - rotate([0, 0, -90])
1.762 - fillet_justified(groove_rr, inner_payload_front_cutout_height + extra);
1.763 -
1.764 - /* Sides of connector. */
1.765 -
1.766 - translate([-connector_width / 2 + groove_depth + groove_ro, -groove_width_extra + groove_ro,
1.767 - lower_extent])
1.768 - rotate([0, 0, 180])
1.769 - fillet_partitioned(groove_rr, inner_connector_front_cutout_height);
1.770 -
1.771 - translate([connector_width / 2 - groove_depth - groove_ro, -groove_width_extra + groove_ro,
1.772 - lower_extent])
1.773 - rotate([0, 0, -90])
1.774 - fillet_partitioned(groove_rr, inner_connector_front_cutout_height);
1.775 -
1.776 - /* Top of payload. */
1.777 -
1.778 - translate([payload_centre, -groove_width_extra + groove_ro,
1.779 - int_payload_upper_extent + inner_top_front_cutout_height - groove_ro])
1.780 - rotate([0, 0, 180])
1.781 - rotate([0, -90, 0])
1.782 - fillet(groove_rr, payload_width - groove_depth * 2);
1.783 + fillet_partitioned(rr, connector_height - bottom);
1.784 }
1.785 }
1.786 }
1.787 + }
1.788
1.789 - /* PCBs for checking. */
1.790 -
1.791 - if (PCB) if (MODEL == ROM_CARTRIDGE) {
1.792 - translate([0, 0, int_payload_lower_extent])
1.793 - difference() {
1.794 + module back_piece(back_displacement, back_rotation) {
1.795 + if (BACK)
1.796 + translate([back_displacement, 0, 0])
1.797 + rotate([0, 0, back_rotation]) {
1.798 + difference() {
1.799 +
1.800 + /* The cartridge surfaces. */
1.801 +
1.802 + union() {
1.803 +
1.804 + /* Back portion. */
1.805 +
1.806 + if (BACK_SURFACE) {
1.807 +
1.808 + /* Surfaces surrounding the payload. */
1.809 +
1.810 + /* Payload section of back surface. */
1.811 +
1.812 + cube_at(payload_width, payload_back, payload_height,
1.813 + 0, 1, 1,
1.814 + payload_centre, int_payload_back_depth, int_payload_lower_extent);
1.815 +
1.816 + cube_at(back_left, back_depth, payload_height,
1.817 + -1, 1, 1,
1.818 + int_payload_left_extent, 0, int_payload_lower_extent);
1.819 +
1.820 + cube_at(back_right, back_depth, payload_height,
1.821 + 1, 1, 1,
1.822 + int_payload_right_extent, 0, int_payload_lower_extent);
1.823 +
1.824 + /* Surfaces surrounding the connector. */
1.825
1.826 - /* Mock PCB. */
1.827 + /* Connector section of back surface overlapping the floor. */
1.828 +
1.829 + if (BACK_CONNECTOR_SECTION) {
1.830 + cube_at(connector_width, connector_back, connector_height,
1.831 + 0, 1, -1,
1.832 + 0, int_connector_back_depth, int_payload_lower_extent);
1.833 +
1.834 + cube_at(back_left, back_depth, connector_height,
1.835 + -1, 1, -1,
1.836 + -int_connector_width / 2, 0, int_payload_lower_extent);
1.837 +
1.838 + cube_at(back_right, back_depth, connector_height,
1.839 + 1, 1, -1,
1.840 + int_connector_width / 2, 0, int_payload_lower_extent);
1.841 + }
1.842 +
1.843 + /* Top of back piece. */
1.844 +
1.845 + if (TOP_SURFACE)
1.846 + cube_at(payload_width, back_depth, top,
1.847 + 0, 1, 1,
1.848 + payload_centre, 0, int_payload_upper_extent);
1.849 +
1.850 + /*
1.851 + The extension of the back to connect with the front. Here, the inside
1.852 + edges are rounded. The outside edges are rounded later.
1.853 +
1.854 + An extra overlapping measure is employed so that the filleting is
1.855 + continuous between the payload and connector portions. On the inside
1.856 + edges, the connector filleting is extended upwards.
1.857 + */
1.858 +
1.859 + /* Left side of payload. */
1.860
1.861 - union() {
1.862 - cube_at(pcb_width, pcb_depth,
1.863 - pcb_height - edge_connector_height,
1.864 - 0, -1, 1,
1.865 - 0, edge_connector_cutout_back_depth, 0);
1.866 - cube_at(edge_connector_width, pcb_depth,
1.867 - edge_connector_height,
1.868 - 0, -1, -1,
1.869 - 0, edge_connector_cutout_back_depth, 0);
1.870 + difference() {
1.871 + cube_at(back_left - groove_depth, groove_width_extra, inner_payload_front_cutout_height,
1.872 + -1, 1, 1,
1.873 + int_payload_left_extent, -groove_width_extra, int_payload_lower_extent);
1.874 + if (ROUND_CONNECTING_EDGES)
1.875 + translate([int_payload_left_extent - groove_ro, -groove_width_extra + groove_ro,
1.876 + int_payload_lower_extent])
1.877 + rotate([0, 0, -90])
1.878 + fillet_justified(groove_rr, inner_payload_front_cutout_height);
1.879 + }
1.880 +
1.881 + /* Right side of payload. */
1.882 +
1.883 + difference() {
1.884 + cube_at(back_right - groove_depth, groove_width_extra, inner_payload_front_cutout_height,
1.885 + 1, 1, 1,
1.886 + int_payload_right_extent, -groove_width_extra, int_payload_lower_extent);
1.887 + if (ROUND_CONNECTING_EDGES)
1.888 + translate([int_payload_right_extent + groove_ro, -groove_width_extra + groove_ro,
1.889 + int_payload_lower_extent])
1.890 + rotate([0, 0, 180])
1.891 + fillet_justified(groove_rr, inner_payload_front_cutout_height);
1.892 + }
1.893 +
1.894 + if (BACK_CONNECTOR_SECTION) {
1.895 +
1.896 + /* Left side of connector. */
1.897
1.898 - /* Feature. */
1.899 + difference() {
1.900 + cube_at(back_left - groove_depth, groove_width_extra,
1.901 + inner_connector_front_cutout_height,
1.902 + -1, 1, -1,
1.903 + -int_connector_width / 2, -groove_width_extra, int_payload_lower_extent);
1.904 + if (ROUND_CONNECTING_EDGES)
1.905 + translate([-int_connector_width / 2 - groove_ro,
1.906 + -groove_width_extra + groove_ro,
1.907 + lower_extent])
1.908 + rotate([0, 0, -90])
1.909 + fillet_partitioned(groove_rr,
1.910 + inner_connector_front_cutout_height + extra);
1.911 + }
1.912 +
1.913 + /* Right side of connector. */
1.914
1.915 - cube_at(feature_width, feature_depth, feature_height,
1.916 - 0, 1, 1,
1.917 - 0, edge_connector_cutout_back_depth, feature_height_offset);
1.918 + difference() {
1.919 + cube_at(back_right - groove_depth, groove_width_extra,
1.920 + inner_connector_front_cutout_height,
1.921 + 1, 1, -1,
1.922 + int_connector_width / 2, -groove_width_extra, int_payload_lower_extent);
1.923 + if (ROUND_CONNECTING_EDGES)
1.924 + translate([int_connector_width / 2 + groove_ro,
1.925 + -groove_width_extra + groove_ro,
1.926 + lower_extent])
1.927 + rotate([0, 0, 180])
1.928 + fillet_partitioned(groove_rr,
1.929 + inner_connector_front_cutout_height + extra);
1.930 + }
1.931 + }
1.932 +
1.933 + /* Top side. */
1.934 +
1.935 + difference() {
1.936 + cube_at(payload_width - groove_depth * 2, groove_width_extra, top - top_groove_depth,
1.937 + 0, 1, 1,
1.938 + payload_centre, -groove_width_extra, int_payload_upper_extent);
1.939 + if (ROUND_CONNECTING_EDGES)
1.940 + translate([payload_centre, -groove_width_extra + groove_ro,
1.941 + int_payload_upper_extent + groove_ro])
1.942 + rotate([0, 0, 180])
1.943 + rotate([0, 90, 0])
1.944 + fillet(groove_rr, payload_width - groove_depth * 2);
1.945 + }
1.946 }
1.947
1.948 - /* Holes for mounting. */
1.949 + difference() {
1.950 +
1.951 + /* Floor of cartridge. */
1.952 +
1.953 + cube_at(connector_width, back_depth, bottom,
1.954 + 0, 1, 1,
1.955 + 0, 0, lower_extent + int_connector_height);
1.956
1.957 - union() {
1.958 - cube_at(pcb_hole_width, pcb_hole_depth, pcb_left_hole_height,
1.959 - -1, -1, 1,
1.960 - pcb_left_hole_offset_from_centre, pcb_hole_start_depth,
1.961 - pcb_left_hole_offset);
1.962 - translate([pcb_left_hole_offset_from_centre -
1.963 - pcb_hole_width / 2, pcb_hole_start_depth, pcb_left_hole_offset])
1.964 - rotate([90, 0, 0])
1.965 - cylinder(h=pcb_hole_depth, r=pcb_hole_width / 2);
1.966 - translate([pcb_left_hole_offset_from_centre -
1.967 - pcb_hole_width / 2, pcb_hole_start_depth,
1.968 - pcb_left_hole_offset + pcb_left_hole_height])
1.969 - rotate([90, 0, 0])
1.970 - cylinder(h=pcb_hole_depth, r=pcb_hole_width / 2);
1.971 + /* Edge connector cutout. */
1.972 +
1.973 + cube_at(edge_connector_cutout_back_width,
1.974 + edge_connector_cutout_back_depth,
1.975 + bottom,
1.976 + 0, 1, 1,
1.977 + 0, 0, lower_extent + int_connector_height);
1.978 }
1.979
1.980 - union() {
1.981 - cube_at(pcb_hole_width, pcb_hole_depth, pcb_right_hole_height,
1.982 - 1, -1, 1,
1.983 - pcb_right_hole_offset_from_centre, pcb_hole_start_depth,
1.984 - pcb_right_hole_offset);
1.985 - translate([pcb_right_hole_offset_from_centre +
1.986 - pcb_hole_width / 2, pcb_hole_start_depth, pcb_right_hole_offset])
1.987 - rotate([90, 0, 0])
1.988 - cylinder(h=pcb_hole_depth, r=pcb_hole_width / 2);
1.989 - translate([pcb_right_hole_offset_from_centre +
1.990 - pcb_hole_width / 2, pcb_hole_start_depth,
1.991 - pcb_right_hole_offset + pcb_right_hole_height])
1.992 - rotate([90, 0, 0])
1.993 - cylinder(h=pcb_hole_depth, r=pcb_hole_width / 2);
1.994 + /* Extended floor. */
1.995 +
1.996 + if (payload_width > connector_width) {
1.997 +
1.998 + difference() {
1.999 +
1.1000 + cube_at(payload_width - connector_width, back_depth, bottom,
1.1001 + 1, 1, 1,
1.1002 + payload_left_extent, 0, lower_extent + int_connector_height);
1.1003 +
1.1004 + cube_at(payload_width - connector_width, edge_connector_cutout_front_depth, bottom,
1.1005 + 1, 1, 1,
1.1006 + payload_left_extent, 0, lower_extent + int_connector_height);
1.1007 + }
1.1008 + }
1.1009 +
1.1010 + /* PCB supports. */
1.1011 +
1.1012 + if (MODEL == ROM_CARTRIDGE) {
1.1013 + pcb_support(-1, pcb_back_support_left_bump_height,
1.1014 + pcb_back_support_left_bump_offset_from_bottom);
1.1015 + pcb_support(1, pcb_back_support_right_bump_height,
1.1016 + pcb_back_support_right_bump_offset_from_bottom);
1.1017 +
1.1018 + /* Circular "lugs" to hold PCBs in place. */
1.1019 +
1.1020 + pcb_lug(-1);
1.1021 + pcb_lug(1);
1.1022 }
1.1023
1.1024 - /* Holes for lugs. */
1.1025 + if (MODEL == WIDE_CARTRIDGE) {
1.1026 +
1.1027 + pcb_lug_wide(1);
1.1028 + pcb_lug_wide(-1);
1.1029 + }
1.1030 + }
1.1031 +
1.1032 + /* Label insets. */
1.1033 +
1.1034 + union() {
1.1035 +
1.1036 + /* Top label. See also the front piece. */
1.1037
1.1038 - translate([
1.1039 - -int_connector_width / 2 + pcb_lug_offset_from_inside,
1.1040 - pcb_hole_start_depth, pcb_lug_offset_from_bottom])
1.1041 - rotate([90, 0, 0])
1.1042 - cylinder(h=pcb_hole_depth, r=pcb_lug_hole_radius);
1.1043 + if (TOP_LABEL_INSET)
1.1044 + translate([top_label_left_extent,
1.1045 + -front_depth + top_label_offset_from_front,
1.1046 + upper_extent - top_label_depth])
1.1047 + cube([top_label_width, top_label_height,
1.1048 + top_label_depth]);
1.1049 + }
1.1050 +
1.1051 + /* Top and side grooves, positioned in the back portion. */
1.1052 +
1.1053 + union() {
1.1054 +
1.1055 + /* Left groove. */
1.1056 +
1.1057 + cube_at(groove_depth, groove_width_normal, height,
1.1058 + 1, 1, 0,
1.1059 + payload_left_extent, 0, 0);
1.1060 +
1.1061 + /* Right groove. */
1.1062
1.1063 - translate([
1.1064 - int_connector_width / 2 - pcb_lug_offset_from_inside,
1.1065 - pcb_hole_start_depth, pcb_lug_offset_from_bottom])
1.1066 - rotate([90, 0, 0])
1.1067 - cylinder(h=pcb_hole_depth, r=pcb_lug_hole_radius);
1.1068 + cube_at(groove_depth, groove_width_normal, height,
1.1069 + -1, 1, 0,
1.1070 + payload_right_extent, 0, 0);
1.1071 +
1.1072 + /* Top grooves. */
1.1073 +
1.1074 + cube_at(payload_width, groove_width_normal, groove_depth,
1.1075 + 0, 1, -1,
1.1076 + payload_centre, 0, upper_extent);
1.1077 +
1.1078 + cube_at(payload_width, top_groove_width, top_groove_depth,
1.1079 + 0, 1, -1,
1.1080 + payload_centre, -groove_width_extra, upper_extent);
1.1081 }
1.1082 - }
1.1083 +
1.1084 + if (BACK_CONNECTOR_SECTION) {
1.1085 +
1.1086 + /* Back cavity. */
1.1087 +
1.1088 + if (BACK_CAVITY)
1.1089 + intersection() {
1.1090 +
1.1091 + /* From the bottom upwards. */
1.1092 +
1.1093 + translate([0, back_depth, lower_extent])
1.1094 + linear_extrude(height = back_cavity_height)
1.1095 + translate([-int_connector_width / 2, 0, 0])
1.1096 + polygon([
1.1097 + [back_cavity_offset_from_inner_left, 0],
1.1098 + [back_cavity_inner_offset_from_inner_left,
1.1099 + -back_cavity_depth],
1.1100 + [back_cavity_inner_offset_from_inner_left +
1.1101 + back_cavity_inner_width,
1.1102 + -back_cavity_depth],
1.1103 + [back_cavity_offset_from_inner_left +
1.1104 + back_cavity_width, 0]
1.1105 + ]);
1.1106 +
1.1107 + /* From left to right. */
1.1108
1.1109 - if (PCB) if (MODEL == WIDE_CARTRIDGE) {
1.1110 - translate([0, 0, int_payload_lower_extent])
1.1111 - difference() {
1.1112 + translate([back_cavity_width / 2, back_depth, lower_extent])
1.1113 + rotate([0, -90, 0])
1.1114 + linear_extrude(height = back_cavity_width)
1.1115 + polygon([
1.1116 + [-extra, -back_cavity_depth],
1.1117 + [back_cavity_inner_height,
1.1118 + -back_cavity_depth],
1.1119 + [back_cavity_height, 0],
1.1120 + [-extra, 0]
1.1121 + ]);
1.1122 + }
1.1123 +
1.1124 + /* Inner back cavities. */
1.1125
1.1126 - /* Mock PCB. */
1.1127 + translate([0, int_connector_back_depth, lower_extent])
1.1128 + linear_extrude(height = int_connector_height)
1.1129 + translate([-int_connector_width / 2, 0, 0])
1.1130 + polygon([
1.1131 + [0, 0],
1.1132 + [inner_back_slope_max_offset, 0],
1.1133 + [inner_back_slope_min_offset,
1.1134 + inner_back_slope_depth],
1.1135 + [0, inner_back_slope_depth]
1.1136 + ]);
1.1137 +
1.1138 + translate([0, int_connector_back_depth, lower_extent])
1.1139 + linear_extrude(height = int_connector_height)
1.1140 + translate([int_connector_width / 2, 0, 0])
1.1141 + polygon([
1.1142 + [0, 0],
1.1143 + [-inner_back_slope_max_offset, 0],
1.1144 + [-inner_back_slope_min_offset,
1.1145 + inner_back_slope_depth],
1.1146 + [0, inner_back_slope_depth]
1.1147 + ]);
1.1148 +
1.1149 + /* Inner back edge cavity. */
1.1150
1.1151 - union() {
1.1152 - cube_at(wide_pcb_width, wide_pcb_depth,
1.1153 - wide_pcb_height - edge_connector_height,
1.1154 - 0, -1, 1,
1.1155 - payload_centre, edge_connector_cutout_back_depth, 0);
1.1156 - cube_at(edge_connector_width, wide_pcb_depth,
1.1157 - edge_connector_height,
1.1158 - 0, -1, -1,
1.1159 - 0, edge_connector_cutout_back_depth, 0);
1.1160 + translate([inner_back_edge_width / 2,
1.1161 + int_connector_back_depth + inner_back_edge_depth, lower_extent])
1.1162 + rotate([0, -90, 0])
1.1163 + linear_extrude(height = inner_back_edge_width)
1.1164 + polygon([
1.1165 + [-extra, -inner_back_edge_depth],
1.1166 + [inner_back_edge_height, -inner_back_edge_depth],
1.1167 + [0, 0],
1.1168 + [-extra, 0]
1.1169 + ]);
1.1170 + }
1.1171 +
1.1172 + /* Fillets to round off the edges. */
1.1173 +
1.1174 + union() {
1.1175 + if (ROUND_EDGES) {
1.1176
1.1177 - /* Feature. */
1.1178 + /* Top left and right rounding. */
1.1179 +
1.1180 + translate([payload_left_extent + ro, back_depth / 2, upper_extent - ro])
1.1181 + rotate([0, 0, 180])
1.1182 + rotate([90, 0, 0])
1.1183 + fillet(rr, back_depth);
1.1184 + translate([payload_right_extent - ro, back_depth / 2, upper_extent - ro])
1.1185 + rotate([90, 0, 0])
1.1186 + fillet(rr, back_depth);
1.1187 +
1.1188 + /* Top back rounding. */
1.1189 +
1.1190 + translate([payload_centre, back_depth - ro, upper_extent - ro])
1.1191 + rotate([0, -90, 0])
1.1192 + fillet(rr, payload_width);
1.1193
1.1194 - cube_at(feature_width, feature_depth, feature_height,
1.1195 - 0, 1, 1,
1.1196 - 0, edge_connector_cutout_back_depth, feature_height_offset);
1.1197 + /* Outer edge rounding. */
1.1198 +
1.1199 + translate([payload_right_extent - ro, back_depth - ro, int_payload_lower_extent - bottom - extra])
1.1200 + fillet_justified(rr, payload_height + bottom + extra);
1.1201 +
1.1202 + translate([payload_left_extent + ro, back_depth - ro, int_payload_lower_extent - bottom - extra])
1.1203 + rotate([0, 0, 90])
1.1204 + fillet_justified(rr, payload_height + bottom + extra);
1.1205 +
1.1206 + if (BACK_CONNECTOR_SECTION) {
1.1207 + translate([connector_width / 2 - ro, back_depth - ro, lower_extent])
1.1208 + fillet_partitioned(rr, connector_height - bottom);
1.1209 +
1.1210 + translate([-connector_width / 2 + ro, back_depth - ro, lower_extent])
1.1211 + rotate([0, 0, 90])
1.1212 + fillet_partitioned(rr, connector_height - bottom);
1.1213 + }
1.1214 }
1.1215
1.1216 - /* Holes for lugs. */
1.1217 + if (ROUND_CONNECTING_EDGES) {
1.1218 +
1.1219 + /*
1.1220 + Outer edge rounding of the back extension. This is done as a
1.1221 + separate removal operation rather than occurring when creating the
1.1222 + extension in order to ensure that the edges are actually rounded.
1.1223 +
1.1224 + An extra overlapping measure is employed so that the filleting is
1.1225 + continuous between the payload and connector portions. On the outside
1.1226 + edges, the payload filleting is extended downwards.
1.1227 + */
1.1228 +
1.1229 + translate([payload_left_extent + groove_depth + groove_ro, -groove_width_extra + groove_ro,
1.1230 + int_payload_lower_extent - extra])
1.1231 + rotate([0, 0, 180])
1.1232 + fillet_justified(groove_rr, inner_payload_front_cutout_height + extra);
1.1233 +
1.1234 + translate([payload_right_extent - groove_depth - groove_ro, -groove_width_extra + groove_ro,
1.1235 + int_payload_lower_extent - extra])
1.1236 + rotate([0, 0, -90])
1.1237 + fillet_justified(groove_rr, inner_payload_front_cutout_height + extra);
1.1238 +
1.1239 + /* Sides of connector. */
1.1240 +
1.1241 + translate([-connector_width / 2 + groove_depth + groove_ro, -groove_width_extra + groove_ro,
1.1242 + lower_extent])
1.1243 + rotate([0, 0, 180])
1.1244 + fillet_partitioned(groove_rr, inner_connector_front_cutout_height);
1.1245 +
1.1246 + translate([connector_width / 2 - groove_depth - groove_ro, -groove_width_extra + groove_ro,
1.1247 + lower_extent])
1.1248 + rotate([0, 0, -90])
1.1249 + fillet_partitioned(groove_rr, inner_connector_front_cutout_height);
1.1250 +
1.1251 + /* Top of payload. */
1.1252
1.1253 - translate([
1.1254 - payload_centre + int_payload_width / 2 - wide_pcb_lug_offset_from_inside ,
1.1255 - wide_pcb_hole_start_depth,
1.1256 - wide_pcb_height - edge_connector_height - wide_pcb_lug_offset_from_bottom])
1.1257 - rotate([90, 0, 0])
1.1258 - cylinder(h=wide_pcb_hole_depth, r=wide_pcb_lug_hole_radius);
1.1259 + translate([payload_centre, -groove_width_extra + groove_ro,
1.1260 + int_payload_upper_extent + inner_top_front_cutout_height - groove_ro])
1.1261 + rotate([0, 0, 180])
1.1262 + rotate([0, -90, 0])
1.1263 + fillet(groove_rr, payload_width - groove_depth * 2);
1.1264 + }
1.1265 + }
1.1266 + }
1.1267 +
1.1268 + /* PCBs for checking. */
1.1269 +
1.1270 + if (PCB) if (MODEL == ROM_CARTRIDGE) {
1.1271 + translate([0, 0, int_payload_lower_extent])
1.1272 + difference() {
1.1273 +
1.1274 + /* Mock PCB. */
1.1275
1.1276 - translate([
1.1277 - payload_centre - int_payload_width / 2 + wide_pcb_lug_offset_from_inside ,
1.1278 - wide_pcb_hole_start_depth,
1.1279 - wide_pcb_height - edge_connector_height - wide_pcb_lug_offset_from_bottom])
1.1280 - rotate([90, 0, 0])
1.1281 - cylinder(h=wide_pcb_hole_depth, r=wide_pcb_lug_hole_radius);
1.1282 + union() {
1.1283 + cube_at(pcb_width, pcb_depth,
1.1284 + pcb_height - edge_connector_height,
1.1285 + 0, -1, 1,
1.1286 + 0, edge_connector_cutout_back_depth, 0);
1.1287 + cube_at(edge_connector_width, pcb_depth,
1.1288 + edge_connector_height,
1.1289 + 0, -1, -1,
1.1290 + 0, edge_connector_cutout_back_depth, 0);
1.1291 +
1.1292 + /* Feature. */
1.1293 +
1.1294 + cube_at(feature_width, feature_depth, feature_height,
1.1295 + 0, 1, 1,
1.1296 + 0, edge_connector_cutout_back_depth, feature_height_offset);
1.1297 + }
1.1298 +
1.1299 + /* Holes for mounting. */
1.1300 +
1.1301 + union() {
1.1302 + cube_at(pcb_hole_width, pcb_hole_depth, pcb_left_hole_height,
1.1303 + -1, -1, 1,
1.1304 + pcb_left_hole_offset_from_centre, pcb_hole_start_depth,
1.1305 + pcb_left_hole_offset);
1.1306 + translate([pcb_left_hole_offset_from_centre -
1.1307 + pcb_hole_width / 2, pcb_hole_start_depth, pcb_left_hole_offset])
1.1308 + rotate([90, 0, 0])
1.1309 + cylinder(h=pcb_hole_depth, r=pcb_hole_width / 2);
1.1310 + translate([pcb_left_hole_offset_from_centre -
1.1311 + pcb_hole_width / 2, pcb_hole_start_depth,
1.1312 + pcb_left_hole_offset + pcb_left_hole_height])
1.1313 + rotate([90, 0, 0])
1.1314 + cylinder(h=pcb_hole_depth, r=pcb_hole_width / 2);
1.1315 + }
1.1316
1.1317 - translate([
1.1318 - payload_centre + int_payload_width / 2 - wide_pcb_lug_offset_from_inside ,
1.1319 - wide_pcb_hole_start_depth,
1.1320 - wide_pcb_lug_offset_from_bottom])
1.1321 - rotate([90, 0, 0])
1.1322 - cylinder(h=wide_pcb_hole_depth, r=wide_pcb_lug_hole_radius);
1.1323 + union() {
1.1324 + cube_at(pcb_hole_width, pcb_hole_depth, pcb_right_hole_height,
1.1325 + 1, -1, 1,
1.1326 + pcb_right_hole_offset_from_centre, pcb_hole_start_depth,
1.1327 + pcb_right_hole_offset);
1.1328 + translate([pcb_right_hole_offset_from_centre +
1.1329 + pcb_hole_width / 2, pcb_hole_start_depth, pcb_right_hole_offset])
1.1330 + rotate([90, 0, 0])
1.1331 + cylinder(h=pcb_hole_depth, r=pcb_hole_width / 2);
1.1332 + translate([pcb_right_hole_offset_from_centre +
1.1333 + pcb_hole_width / 2, pcb_hole_start_depth,
1.1334 + pcb_right_hole_offset + pcb_right_hole_height])
1.1335 + rotate([90, 0, 0])
1.1336 + cylinder(h=pcb_hole_depth, r=pcb_hole_width / 2);
1.1337 + }
1.1338 +
1.1339 + /* Holes for lugs. */
1.1340 +
1.1341 + translate([
1.1342 + -int_connector_width / 2 + pcb_lug_offset_from_inside,
1.1343 + pcb_hole_start_depth, pcb_lug_offset_from_bottom])
1.1344 + rotate([90, 0, 0])
1.1345 + cylinder(h=pcb_hole_depth, r=pcb_lug_hole_radius);
1.1346 +
1.1347 + translate([
1.1348 + int_connector_width / 2 - pcb_lug_offset_from_inside,
1.1349 + pcb_hole_start_depth, pcb_lug_offset_from_bottom])
1.1350 + rotate([90, 0, 0])
1.1351 + cylinder(h=pcb_hole_depth, r=pcb_lug_hole_radius);
1.1352 + }
1.1353 + }
1.1354 +
1.1355 + if (PCB) if (MODEL == WIDE_CARTRIDGE) {
1.1356 + translate([0, 0, int_payload_lower_extent])
1.1357 + difference() {
1.1358 +
1.1359 + /* Mock PCB. */
1.1360 +
1.1361 + union() {
1.1362 + cube_at(wide_pcb_width, wide_pcb_depth,
1.1363 + wide_pcb_height - edge_connector_height,
1.1364 + 0, -1, 1,
1.1365 + payload_centre, edge_connector_cutout_back_depth, 0);
1.1366 + cube_at(edge_connector_width, wide_pcb_depth,
1.1367 + edge_connector_height,
1.1368 + 0, -1, -1,
1.1369 + 0, edge_connector_cutout_back_depth, 0);
1.1370 +
1.1371 + /* Feature. */
1.1372
1.1373 - translate([
1.1374 - payload_centre - int_payload_width / 2 + wide_pcb_lug_offset_from_inside ,
1.1375 - wide_pcb_hole_start_depth,
1.1376 - wide_pcb_lug_offset_from_bottom])
1.1377 - rotate([90, 0, 0])
1.1378 - cylinder(h=wide_pcb_hole_depth, r=wide_pcb_lug_hole_radius);
1.1379 - }
1.1380 + cube_at(feature_width, feature_depth, feature_height,
1.1381 + 0, 1, 1,
1.1382 + 0, edge_connector_cutout_back_depth, feature_height_offset);
1.1383 + }
1.1384 +
1.1385 + /* Holes for lugs. */
1.1386 +
1.1387 + translate([
1.1388 + payload_centre + int_payload_width / 2 - wide_pcb_lug_offset_from_inside ,
1.1389 + wide_pcb_hole_start_depth,
1.1390 + wide_pcb_height - edge_connector_height - wide_pcb_lug_offset_from_bottom])
1.1391 + rotate([90, 0, 0])
1.1392 + cylinder(h=wide_pcb_hole_depth, r=wide_pcb_lug_hole_radius);
1.1393 +
1.1394 + translate([
1.1395 + payload_centre - int_payload_width / 2 + wide_pcb_lug_offset_from_inside ,
1.1396 + wide_pcb_hole_start_depth,
1.1397 + wide_pcb_height - edge_connector_height - wide_pcb_lug_offset_from_bottom])
1.1398 + rotate([90, 0, 0])
1.1399 + cylinder(h=wide_pcb_hole_depth, r=wide_pcb_lug_hole_radius);
1.1400 +
1.1401 + translate([
1.1402 + payload_centre + int_payload_width / 2 - wide_pcb_lug_offset_from_inside ,
1.1403 + wide_pcb_hole_start_depth,
1.1404 + wide_pcb_lug_offset_from_bottom])
1.1405 + rotate([90, 0, 0])
1.1406 + cylinder(h=wide_pcb_hole_depth, r=wide_pcb_lug_hole_radius);
1.1407 +
1.1408 + translate([
1.1409 + payload_centre - int_payload_width / 2 + wide_pcb_lug_offset_from_inside ,
1.1410 + wide_pcb_hole_start_depth,
1.1411 + wide_pcb_lug_offset_from_bottom])
1.1412 + rotate([90, 0, 0])
1.1413 + cylinder(h=wide_pcb_hole_depth, r=wide_pcb_lug_hole_radius);
1.1414 + }
1.1415 + }
1.1416 }
1.1417 + }
1.1418 +
1.1419 + /*
1.1420 + Place the back piece next to the front, with the internals facing out
1.1421 + the same way, if APART is defined.
1.1422 + */
1.1423 +
1.1424 + front_displacement_together = CLOSED ? front_back_overlap : 0;
1.1425 + front_displacement = APART ? -connector_width * 0.6 : 0;
1.1426 + back_displacement = APART ? connector_width * 0.6 : 0;
1.1427 + back_rotation = APART ? 180 : 0;
1.1428 +
1.1429 + if (INTERSECT) {
1.1430 + intersection() {
1.1431 + front_piece(0, front_displacement_together);
1.1432 + back_piece(0, 0);
1.1433 }
1.1434 + } else {
1.1435 + front_piece(front_displacement, front_displacement_together);
1.1436 + back_piece(back_displacement, back_rotation);
1.1437 + }
1.1438 }
1.1439
1.1440 cartridge();