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