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