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