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