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