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