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