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@16 | 177 | |
paul@24 | 178 | /* Move the PCB support towards the centre. */ |
paul@24 | 179 | pcb_support_margin = 0.55; |
paul@24 | 180 | |
paul@25 | 181 | pcb_lug_depth = pcb_back_support_depth + |
paul@25 | 182 | pcb_back_support_bump_depth; |
paul@25 | 183 | pcb_lug_inner_radius = 1.0; |
paul@25 | 184 | pcb_lug_outer_radius = 5.5 / 2; |
paul@25 | 185 | pcb_lug_offset_from_bottom = 14.35; |
paul@25 | 186 | pcb_lug_offset_from_outside = 7.55; |
paul@25 | 187 | |
paul@25 | 188 | pcb_lug_cross_width = 6.7; |
paul@25 | 189 | pcb_lug_cross_depth = pcb_lug_depth; |
paul@25 | 190 | pcb_lug_cross_height = 1.4; |
paul@25 | 191 | |
paul@25 | 192 | /* Repeated constructs. */ |
paul@25 | 193 | |
paul@26 | 194 | module pcb_support(xdir, bump_height, bump_offset) { |
paul@25 | 195 | translate([xdir * |
paul@25 | 196 | (edge_connector_cutout_back_width / 2 - pcb_support_margin), |
paul@25 | 197 | edge_connector_cutout_back_depth, |
paul@25 | 198 | -height / 2 + bottom + bottom_from_base]) |
paul@25 | 199 | justify(pcb_back_support_width, |
paul@25 | 200 | pcb_back_support_depth, |
paul@25 | 201 | pcb_back_support_height, |
paul@25 | 202 | xdir, 1, 1) |
paul@25 | 203 | union() { |
paul@25 | 204 | cube([pcb_back_support_width, |
paul@25 | 205 | pcb_back_support_depth, |
paul@25 | 206 | pcb_back_support_height], center = true); |
paul@25 | 207 | cube_at(pcb_back_support_bump_width, |
paul@25 | 208 | pcb_back_support_bump_depth, |
paul@26 | 209 | bump_height, |
paul@25 | 210 | 0, -1, 1, |
paul@25 | 211 | 0, |
paul@25 | 212 | -pcb_back_support_depth / 2, |
paul@26 | 213 | -pcb_back_support_height / 2 + bump_offset); |
paul@25 | 214 | } |
paul@25 | 215 | } |
paul@25 | 216 | |
paul@25 | 217 | module pcb_lug(xdir) { |
paul@25 | 218 | translate([xdir * |
paul@25 | 219 | (width/2 - pcb_lug_offset_from_outside), |
paul@25 | 220 | back_depth, |
paul@25 | 221 | -height / 2 + bottom + bottom_from_base + |
paul@25 | 222 | pcb_lug_offset_from_bottom |
paul@25 | 223 | ]) |
paul@25 | 224 | rotate([90, 0, 0]) |
paul@25 | 225 | difference() { |
paul@25 | 226 | union() { |
paul@25 | 227 | cylinder(h=pcb_lug_depth, r=pcb_lug_outer_radius); |
paul@25 | 228 | cube_at(pcb_lug_cross_width, |
paul@25 | 229 | pcb_lug_cross_height, pcb_lug_cross_depth, |
paul@25 | 230 | 0, 0, 1, |
paul@25 | 231 | 0, 0, 0); |
paul@25 | 232 | cube_at(pcb_lug_cross_height, |
paul@25 | 233 | pcb_lug_cross_width, pcb_lug_cross_depth, |
paul@25 | 234 | 0, 0, 1, |
paul@25 | 235 | 0, 0, 0); |
paul@25 | 236 | } |
paul@25 | 237 | cylinder(h=pcb_lug_depth, r=pcb_lug_inner_radius); |
paul@25 | 238 | } |
paul@25 | 239 | } |
paul@25 | 240 | |
paul@25 | 241 | /* The actual shapes. */ |
paul@25 | 242 | |
paul@19 | 243 | translate([-width * 0.6, 0, 0]) |
paul@0 | 244 | difference() { |
paul@1 | 245 | |
paul@1 | 246 | /* The cartridge surfaces. */ |
paul@1 | 247 | |
paul@0 | 248 | union() { |
paul@8 | 249 | |
paul@8 | 250 | /* Front portion. */ |
paul@8 | 251 | |
paul@8 | 252 | translate([0, -front_depth + front / 2, 0]) |
paul@0 | 253 | cube([width, front, height], center = true); |
paul@8 | 254 | translate([-width / 2 + front_left / 2, -front_depth / 2, 0]) |
paul@8 | 255 | cube([front_left, front_depth, height], center = true); |
paul@8 | 256 | translate([width / 2 - front_right / 2, -front_depth / 2, 0]) |
paul@8 | 257 | cube([front_right, front_depth, height], center = true); |
paul@8 | 258 | translate([0, -front_depth / 2, height / 2 - top / 2]) |
paul@8 | 259 | cube([width, front_depth, top], center = true); |
paul@8 | 260 | difference() { |
paul@20 | 261 | |
paul@20 | 262 | /* Floor of cartridge. */ |
paul@20 | 263 | |
paul@20 | 264 | cube_at(width, front_depth, bottom, |
paul@20 | 265 | 0, -1, 1, |
paul@20 | 266 | 0, 0, -height / 2 + bottom_from_base); |
paul@20 | 267 | |
paul@20 | 268 | /* Left cutout. */ |
paul@20 | 269 | |
paul@20 | 270 | cube_at(edge_connector_cutout_front_width, |
paul@20 | 271 | edge_connector_cutout_front_depth, |
paul@20 | 272 | bottom, |
paul@20 | 273 | 1, -1, 1, |
paul@20 | 274 | -width / 2 + edge_connector_cutout_front_offset, |
paul@20 | 275 | 0, |
paul@20 | 276 | -height / 2 + bottom_from_base); |
paul@20 | 277 | |
paul@20 | 278 | /* Right cutout. */ |
paul@20 | 279 | |
paul@20 | 280 | cube_at(edge_connector_cutout_front_width, |
paul@20 | 281 | edge_connector_cutout_front_depth, |
paul@20 | 282 | bottom, |
paul@20 | 283 | -1, -1, 1, |
paul@20 | 284 | width / 2 - edge_connector_cutout_front_offset, |
paul@20 | 285 | 0, |
paul@20 | 286 | -height / 2 + bottom_from_base); |
paul@8 | 287 | } |
paul@15 | 288 | |
paul@15 | 289 | /* PCB supports. */ |
paul@15 | 290 | |
paul@20 | 291 | cube_at(pcb_front_support_width, |
paul@20 | 292 | pcb_front_support_depth, |
paul@20 | 293 | pcb_front_support_height, |
paul@20 | 294 | 1, -1, 1, |
paul@24 | 295 | -edge_connector_cutout_back_width / 2 + |
paul@24 | 296 | pcb_support_margin, |
paul@20 | 297 | 0, |
paul@20 | 298 | -height / 2 + bottom + bottom_from_base); |
paul@15 | 299 | |
paul@20 | 300 | cube_at(pcb_front_support_width, |
paul@20 | 301 | pcb_front_support_depth, |
paul@20 | 302 | pcb_front_support_height, |
paul@20 | 303 | -1, -1, 1, |
paul@24 | 304 | edge_connector_cutout_back_width / 2 - |
paul@24 | 305 | pcb_support_margin, |
paul@20 | 306 | 0, |
paul@20 | 307 | -height / 2 + bottom + bottom_from_base); |
paul@10 | 308 | } |
paul@10 | 309 | |
paul@10 | 310 | /* Label insets. */ |
paul@10 | 311 | |
paul@10 | 312 | union() { |
paul@10 | 313 | |
paul@10 | 314 | /* Front label. */ |
paul@10 | 315 | |
paul@10 | 316 | translate([-front_label_width / 2, -front_depth, |
paul@10 | 317 | front_label_offset_from_bottom - height / 2]) |
paul@10 | 318 | cube([front_label_width, front_label_depth, |
paul@10 | 319 | front_label_height]); |
paul@10 | 320 | |
paul@10 | 321 | /* Top label. */ |
paul@10 | 322 | |
paul@10 | 323 | translate([-top_label_width / 2, |
paul@10 | 324 | -front_depth + top_label_offset_from_front, |
paul@10 | 325 | height / 2 - top_label_depth]) |
paul@10 | 326 | cube([top_label_width, top_label_height, |
paul@10 | 327 | top_label_depth]); |
paul@10 | 328 | } |
paul@10 | 329 | |
paul@10 | 330 | /* Inner front edge cavity. */ |
paul@10 | 331 | |
paul@10 | 332 | translate([inner_front_edge_width / 2, |
paul@10 | 333 | -front_depth + inner_front_edge_offset, -height / 2]) |
paul@10 | 334 | rotate([0, -90, 0]) |
paul@10 | 335 | linear_extrude(height = inner_front_edge_width) |
paul@10 | 336 | polygon([ |
paul@10 | 337 | [-extra, 0], |
paul@10 | 338 | [0, 0], |
paul@10 | 339 | [inner_front_edge_height, inner_front_edge_depth], |
paul@10 | 340 | [-extra, inner_front_edge_depth], |
paul@10 | 341 | ]); |
paul@10 | 342 | |
paul@11 | 343 | /* Inner top cutout for the top of the back portion. */ |
paul@11 | 344 | |
paul@11 | 345 | translate([0, -inner_top_front_cutout_depth / 2, height / 2 - |
paul@11 | 346 | inner_top_front_cutout_offset - |
paul@11 | 347 | inner_top_front_cutout_depth / 2]) |
paul@11 | 348 | cube([inner_top_front_cutout_width, |
paul@11 | 349 | inner_top_front_cutout_depth, |
paul@11 | 350 | inner_top_front_cutout_depth], center = true); |
paul@11 | 351 | |
paul@10 | 352 | /* Fillets to round off the edges. */ |
paul@10 | 353 | |
paul@10 | 354 | union() { |
paul@10 | 355 | |
paul@10 | 356 | /* Top left and right rounding. */ |
paul@10 | 357 | |
paul@10 | 358 | translate([-width / 2 + ro, -front_depth / 2, height / 2 - ro]) |
paul@10 | 359 | rotate([0, 0, 180]) |
paul@10 | 360 | rotate([90, 0, 0]) |
paul@10 | 361 | fillet(rr, front_depth); |
paul@10 | 362 | translate([width / 2 - ro, -front_depth / 2, height / 2 - ro]) |
paul@10 | 363 | rotate([90, 0, 0]) |
paul@10 | 364 | fillet(rr, front_depth); |
paul@10 | 365 | |
paul@10 | 366 | /* Top front rounding. */ |
paul@10 | 367 | |
paul@10 | 368 | translate([0, -front_depth + ro, height / 2 - ro]) |
paul@10 | 369 | rotate([0, 0, 180]) |
paul@10 | 370 | rotate([0, -90, 0]) |
paul@10 | 371 | fillet(rr, width); |
paul@10 | 372 | |
paul@10 | 373 | /* Edge rounding. */ |
paul@10 | 374 | |
paul@10 | 375 | translate([-width / 2 + ro, -front_depth + ro, 0]) |
paul@10 | 376 | rotate([0, 0, 180]) |
paul@10 | 377 | fillet(rr, height); |
paul@10 | 378 | translate([width / 2 - ro, -front_depth + ro, 0]) |
paul@10 | 379 | rotate([0, 0, 270]) |
paul@10 | 380 | fillet(rr, height); |
paul@10 | 381 | } |
paul@10 | 382 | } |
paul@10 | 383 | |
paul@19 | 384 | translate([width * 0.6, 0, 0]) |
paul@19 | 385 | rotate([0, 0, 180]) |
paul@10 | 386 | difference() { |
paul@10 | 387 | |
paul@10 | 388 | /* The cartridge surfaces. */ |
paul@10 | 389 | |
paul@10 | 390 | union() { |
paul@8 | 391 | |
paul@8 | 392 | /* Back portion. */ |
paul@8 | 393 | |
paul@8 | 394 | translate([0, back_depth - back / 2, 0]) |
paul@0 | 395 | cube([width, back, height], center = true); |
paul@8 | 396 | translate([-width / 2 + back_left / 2, back_depth / 2, 0]) |
paul@8 | 397 | cube([back_left, back_depth, height], center = true); |
paul@8 | 398 | translate([width / 2 - back_right / 2, back_depth / 2, 0]) |
paul@8 | 399 | cube([back_right, back_depth, height], center = true); |
paul@8 | 400 | translate([0, back_depth / 2, height / 2 - top / 2]) |
paul@8 | 401 | cube([width, back_depth, top], center = true); |
paul@8 | 402 | difference() { |
paul@20 | 403 | |
paul@20 | 404 | /* Floor of cartridge. */ |
paul@20 | 405 | |
paul@20 | 406 | cube_at(width, back_depth, bottom, |
paul@20 | 407 | 0, 1, 1, |
paul@20 | 408 | 0, 0, -height / 2 + bottom_from_base); |
paul@20 | 409 | |
paul@20 | 410 | /* Edge connector cutout. */ |
paul@20 | 411 | |
paul@20 | 412 | cube_at(edge_connector_cutout_back_width, |
paul@20 | 413 | edge_connector_cutout_back_depth, |
paul@20 | 414 | bottom, |
paul@20 | 415 | 0, 1, 1, |
paul@20 | 416 | 0, 0, -height / 2 + bottom_from_base); |
paul@8 | 417 | } |
paul@14 | 418 | |
paul@14 | 419 | /* PCB supports. */ |
paul@14 | 420 | |
paul@26 | 421 | pcb_support(-1, pcb_back_support_left_bump_height, |
paul@26 | 422 | pcb_back_support_left_bump_offset_from_bottom); |
paul@26 | 423 | pcb_support(1, pcb_back_support_right_bump_height, |
paul@26 | 424 | pcb_back_support_right_bump_offset_from_bottom); |
paul@14 | 425 | |
paul@25 | 426 | /* Circular "lugs" to hold PCBs in place. */ |
paul@25 | 427 | |
paul@25 | 428 | pcb_lug(-1); |
paul@25 | 429 | pcb_lug(1); |
paul@0 | 430 | } |
paul@0 | 431 | |
paul@1 | 432 | /* Label insets. */ |
paul@1 | 433 | |
paul@1 | 434 | union() { |
paul@1 | 435 | |
paul@1 | 436 | /* Top label. */ |
paul@1 | 437 | |
paul@1 | 438 | translate([-top_label_width / 2, |
paul@8 | 439 | -front_depth + top_label_offset_from_front, |
paul@1 | 440 | height / 2 - top_label_depth]) |
paul@1 | 441 | cube([top_label_width, top_label_height, |
paul@1 | 442 | top_label_depth]); |
paul@1 | 443 | } |
paul@1 | 444 | |
paul@8 | 445 | /* Top and side grooves, positioned in the back portion. */ |
paul@2 | 446 | |
paul@2 | 447 | union() { |
paul@2 | 448 | |
paul@2 | 449 | /* Left groove. */ |
paul@2 | 450 | |
paul@8 | 451 | translate([-width / 2 + groove_depth / 2, groove_width / 2, 0]) |
paul@8 | 452 | cube([groove_depth, groove_width, height], |
paul@4 | 453 | center = true); |
paul@2 | 454 | |
paul@2 | 455 | /* Right groove. */ |
paul@2 | 456 | |
paul@8 | 457 | translate([width / 2 - groove_depth / 2, groove_width / 2, 0]) |
paul@8 | 458 | cube([groove_depth, groove_width, height], |
paul@4 | 459 | center = true); |
paul@2 | 460 | |
paul@8 | 461 | /* Top grooves. */ |
paul@2 | 462 | |
paul@8 | 463 | translate([0, groove_width / 2, height / 2 - groove_depth / 2]) |
paul@8 | 464 | cube([width, groove_width, groove_depth], |
paul@8 | 465 | center = true); |
paul@8 | 466 | |
paul@8 | 467 | translate([0, top_groove_width / 2, |
paul@8 | 468 | height / 2 - top_groove_depth / 2]) |
paul@8 | 469 | cube([width, top_groove_width, top_groove_depth], |
paul@4 | 470 | center = true); |
paul@4 | 471 | } |
paul@4 | 472 | |
paul@4 | 473 | /* Back cavity. */ |
paul@4 | 474 | |
paul@4 | 475 | intersection() { |
paul@4 | 476 | |
paul@4 | 477 | /* From the bottom upwards. */ |
paul@4 | 478 | |
paul@8 | 479 | translate([0, back_depth, -height / 2]) |
paul@4 | 480 | linear_extrude(height = back_cavity_height) |
paul@4 | 481 | translate([-width / 2, 0, 0]) |
paul@4 | 482 | polygon([ |
paul@4 | 483 | [back_cavity_offset_from_left, 0], |
paul@4 | 484 | [back_cavity_inner_offset_from_left, |
paul@4 | 485 | -back_cavity_depth], |
paul@4 | 486 | [back_cavity_inner_offset_from_left + |
paul@4 | 487 | back_cavity_inner_width, |
paul@4 | 488 | -back_cavity_depth], |
paul@4 | 489 | [back_cavity_offset_from_left + |
paul@4 | 490 | back_cavity_width, 0] |
paul@4 | 491 | ]); |
paul@4 | 492 | |
paul@4 | 493 | /* From left to right. */ |
paul@4 | 494 | |
paul@8 | 495 | translate([back_cavity_width / 2, back_depth, -height / 2]) |
paul@4 | 496 | rotate([0, -90, 0]) |
paul@4 | 497 | linear_extrude(height = back_cavity_width) |
paul@4 | 498 | polygon([ |
paul@4 | 499 | [-extra, -back_cavity_depth], |
paul@4 | 500 | [back_cavity_inner_height, |
paul@4 | 501 | -back_cavity_depth], |
paul@4 | 502 | [back_cavity_height, 0], |
paul@4 | 503 | [-extra, 0] |
paul@4 | 504 | ]); |
paul@2 | 505 | } |
paul@2 | 506 | |
paul@5 | 507 | /* Inner back cavities. */ |
paul@5 | 508 | |
paul@8 | 509 | translate([0, back_depth - inner_back_cavity_offset, -height / 2]) |
paul@5 | 510 | linear_extrude(height = bottom_from_base) |
paul@5 | 511 | translate([-width / 2, 0, 0]) |
paul@5 | 512 | polygon([ |
paul@5 | 513 | [inner_back_cavity_offset_from_left, 0], |
paul@5 | 514 | [inner_back_slope_offset_from_left, 0], |
paul@5 | 515 | [inner_back_slope_offset_from_left + |
paul@5 | 516 | inner_back_slope_width, |
paul@5 | 517 | -inner_back_slope_depth], |
paul@5 | 518 | [inner_back_cavity_offset_from_left, |
paul@5 | 519 | -inner_back_slope_depth] |
paul@5 | 520 | ]); |
paul@5 | 521 | |
paul@8 | 522 | translate([0, back_depth - inner_back_cavity_offset, -height / 2]) |
paul@5 | 523 | linear_extrude(height = bottom_from_base) |
paul@5 | 524 | translate([-width / 2, 0, 0]) |
paul@5 | 525 | polygon([ |
paul@5 | 526 | [width - inner_back_slope_offset_from_left, 0], |
paul@5 | 527 | [width - inner_back_cavity_offset_from_left, 0], |
paul@5 | 528 | [width - inner_back_cavity_offset_from_left, |
paul@5 | 529 | -inner_back_slope_depth], |
paul@5 | 530 | [width - inner_back_slope_offset_from_left - |
paul@5 | 531 | inner_back_slope_width, |
paul@5 | 532 | -inner_back_slope_depth] |
paul@5 | 533 | ]); |
paul@5 | 534 | |
paul@7 | 535 | /* Inner back edge cavity. */ |
paul@7 | 536 | |
paul@5 | 537 | translate([inner_back_edge_width / 2, |
paul@8 | 538 | back_depth - inner_back_edge_offset, -height / 2]) |
paul@5 | 539 | rotate([0, -90, 0]) |
paul@5 | 540 | linear_extrude(height = inner_back_edge_width) |
paul@5 | 541 | polygon([ |
paul@5 | 542 | [-extra, -inner_back_edge_depth], |
paul@5 | 543 | [inner_back_edge_height, -inner_back_edge_depth], |
paul@5 | 544 | [0, 0], |
paul@5 | 545 | [-extra, 0] |
paul@5 | 546 | ]); |
paul@5 | 547 | |
paul@1 | 548 | /* Fillets to round off the edges. */ |
paul@1 | 549 | |
paul@0 | 550 | union() { |
paul@0 | 551 | |
paul@0 | 552 | /* Top left and right rounding. */ |
paul@0 | 553 | |
paul@9 | 554 | translate([-width / 2 + ro, back_depth / 2, height / 2 - ro]) |
paul@9 | 555 | rotate([0, 0, 180]) |
paul@9 | 556 | rotate([90, 0, 0]) |
paul@9 | 557 | fillet(rr, back_depth); |
paul@9 | 558 | translate([width / 2 - ro, back_depth / 2, height / 2 - ro]) |
paul@9 | 559 | rotate([90, 0, 0]) |
paul@9 | 560 | fillet(rr, back_depth); |
paul@0 | 561 | |
paul@10 | 562 | /* Top back rounding. */ |
paul@0 | 563 | |
paul@8 | 564 | translate([0, back_depth - ro, height / 2 - ro]) |
paul@0 | 565 | rotate([0, -90, 0]) |
paul@3 | 566 | fillet(rr, width); |
paul@0 | 567 | |
paul@0 | 568 | /* Edge rounding. */ |
paul@0 | 569 | |
paul@8 | 570 | translate([width / 2 - ro, back_depth - ro, 0]) |
paul@3 | 571 | fillet(rr, height); |
paul@8 | 572 | translate([-width / 2 + ro, back_depth - ro, 0]) |
paul@0 | 573 | rotate([0, 0, 90]) |
paul@3 | 574 | fillet(rr, height); |
paul@0 | 575 | } |
paul@0 | 576 | } |
paul@0 | 577 | } |
paul@0 | 578 | |
paul@0 | 579 | cartridge(); |
paul@0 | 580 | |