paul@0 | 1 | module cartridge() |
paul@0 | 2 | { |
paul@0 | 3 | $fn = 50; |
paul@0 | 4 | |
paul@3 | 5 | /* Rounding/fillet radius and additional margin of subtracted |
paul@3 | 6 | material. The additional margin helps avoid geometry |
paul@3 | 7 | problems. */ |
paul@3 | 8 | |
paul@3 | 9 | rr = 1; |
paul@3 | 10 | ro = rr; |
paul@3 | 11 | extra = 0.1; |
paul@3 | 12 | |
paul@0 | 13 | module fillet(r, h) { |
paul@0 | 14 | translate([0, 0, -h/2]) |
paul@0 | 15 | difference() { |
paul@12 | 16 | cube([r + extra, r + extra, h + extra]); |
paul@0 | 17 | cylinder(r = r, h = h); |
paul@0 | 18 | } |
paul@0 | 19 | } |
paul@0 | 20 | |
paul@0 | 21 | /* Cartridge dimensions. */ |
paul@0 | 22 | |
paul@0 | 23 | width = 89.0; |
paul@0 | 24 | height = 68.5; |
paul@0 | 25 | depth = 16.5; |
paul@8 | 26 | front_depth = 6.5; |
paul@8 | 27 | back_depth = 11.0; |
paul@0 | 28 | |
paul@1 | 29 | /* Details. */ |
paul@1 | 30 | |
paul@1 | 31 | front_label_width = 83.0; |
paul@1 | 32 | front_label_height = 46.0; |
paul@1 | 33 | front_label_depth = 1.0; |
paul@1 | 34 | front_label_offset_from_bottom = 19.5; |
paul@3 | 35 | |
paul@1 | 36 | top_label_width = front_label_width; |
paul@1 | 37 | top_label_height = 11.5; |
paul@1 | 38 | top_label_depth = front_label_depth; |
paul@1 | 39 | top_label_offset_from_front = 2.5; |
paul@3 | 40 | |
paul@8 | 41 | groove_width = 2.5; /* how much the groove cuts out of the back */ |
paul@8 | 42 | groove_depth = 1.0; /* how deep the groove goes into each side */ |
paul@8 | 43 | top_groove_width = 1.0; |
paul@8 | 44 | top_groove_depth = 2.0; |
paul@9 | 45 | inner_top_front_cutout_width = 87.0; |
paul@9 | 46 | inner_top_front_cutout_depth = 1.0; |
paul@9 | 47 | inner_top_front_cutout_offset = 2.0; |
paul@1 | 48 | |
paul@4 | 49 | back_cavity_width = 68.0; |
paul@4 | 50 | back_cavity_inner_width = 65.0; |
paul@4 | 51 | back_cavity_offset_from_left = 10.5; |
paul@4 | 52 | back_cavity_inner_offset_from_left = 12.0; |
paul@4 | 53 | back_cavity_height = 13.5; |
paul@4 | 54 | back_cavity_inner_height = 12.0; |
paul@4 | 55 | back_cavity_depth = 1.5; |
paul@4 | 56 | |
paul@6 | 57 | inner_back_cavity_offset = 1.0; |
paul@5 | 58 | inner_back_cavity_offset_from_left = 2.0; |
paul@5 | 59 | inner_back_slope_offset_from_left = 10.0; |
paul@5 | 60 | inner_back_slope_width = 2.5; |
paul@6 | 61 | inner_back_slope_depth = 2.5; |
paul@5 | 62 | |
paul@5 | 63 | inner_back_edge_offset = 2.0; |
paul@5 | 64 | inner_back_edge_width = 69.0; |
paul@5 | 65 | inner_back_edge_height = 3.0; |
paul@5 | 66 | inner_back_edge_depth = 1.5; |
paul@5 | 67 | |
paul@7 | 68 | inner_front_edge_offset = 0.5; |
paul@7 | 69 | inner_front_edge_width = 87.0; |
paul@7 | 70 | inner_front_edge_height = 3.0; |
paul@7 | 71 | inner_front_edge_depth = 1.5; |
paul@7 | 72 | |
paul@5 | 73 | bottom_from_base = 13.5; |
paul@5 | 74 | |
paul@8 | 75 | edge_connector_cutout_front_offset = 1.0; |
paul@8 | 76 | edge_connector_cutout_front_depth = 1.0; |
paul@8 | 77 | edge_connector_cutout_front_width = 15.0; |
paul@8 | 78 | edge_connector_cutout_back_depth = 3.0; |
paul@8 | 79 | edge_connector_cutout_back_width = 57.0; |
paul@8 | 80 | |
paul@0 | 81 | /* Side thicknesses. */ |
paul@0 | 82 | |
paul@0 | 83 | front = 2; |
paul@0 | 84 | back = 3.5; |
paul@0 | 85 | top = 3; |
paul@8 | 86 | front_left = 1; |
paul@8 | 87 | front_right = 1; |
paul@8 | 88 | back_left = 2; |
paul@8 | 89 | back_right = 2; |
paul@5 | 90 | bottom = 2; |
paul@0 | 91 | |
paul@14 | 92 | /* Extra internal features. */ |
paul@14 | 93 | |
paul@14 | 94 | pcb_back_support_width = 1.0; |
paul@14 | 95 | pcb_back_support_depth = back_depth - |
paul@14 | 96 | edge_connector_cutout_back_depth; |
paul@14 | 97 | pcb_back_support_height = height - bottom_from_base - top - bottom; |
paul@14 | 98 | |
paul@15 | 99 | pcb_front_support_width = 1.0; |
paul@15 | 100 | pcb_front_support_depth = front_depth; |
paul@15 | 101 | pcb_front_support_height = pcb_back_support_height; |
paul@15 | 102 | |
paul@13 | 103 | translate([0, -20, 0]) |
paul@0 | 104 | difference() { |
paul@1 | 105 | |
paul@1 | 106 | /* The cartridge surfaces. */ |
paul@1 | 107 | |
paul@0 | 108 | union() { |
paul@8 | 109 | |
paul@8 | 110 | /* Front portion. */ |
paul@8 | 111 | |
paul@8 | 112 | translate([0, -front_depth + front / 2, 0]) |
paul@0 | 113 | cube([width, front, height], center = true); |
paul@8 | 114 | translate([-width / 2 + front_left / 2, -front_depth / 2, 0]) |
paul@8 | 115 | cube([front_left, front_depth, height], center = true); |
paul@8 | 116 | translate([width / 2 - front_right / 2, -front_depth / 2, 0]) |
paul@8 | 117 | cube([front_right, front_depth, height], center = true); |
paul@8 | 118 | translate([0, -front_depth / 2, height / 2 - top / 2]) |
paul@8 | 119 | cube([width, front_depth, top], center = true); |
paul@8 | 120 | difference() { |
paul@8 | 121 | translate([0, -front_depth / 2, |
paul@8 | 122 | -height / 2 + bottom / 2 + bottom_from_base]) |
paul@8 | 123 | cube([width, front_depth, bottom], center = true); |
paul@8 | 124 | translate([-width / 2 + edge_connector_cutout_front_offset + |
paul@8 | 125 | edge_connector_cutout_front_width / 2, |
paul@8 | 126 | -edge_connector_cutout_front_depth / 2, |
paul@8 | 127 | -height / 2 + bottom / 2 + bottom_from_base]) |
paul@8 | 128 | cube([edge_connector_cutout_front_width, |
paul@8 | 129 | edge_connector_cutout_front_depth, |
paul@8 | 130 | bottom + extra], center = true); |
paul@8 | 131 | translate([width / 2 - edge_connector_cutout_front_offset - |
paul@8 | 132 | edge_connector_cutout_front_width / 2, |
paul@8 | 133 | -edge_connector_cutout_front_depth / 2, |
paul@8 | 134 | -height / 2 + bottom / 2 + bottom_from_base]) |
paul@8 | 135 | cube([edge_connector_cutout_front_width, |
paul@8 | 136 | edge_connector_cutout_front_depth, |
paul@8 | 137 | bottom + extra], center = true); |
paul@8 | 138 | } |
paul@15 | 139 | |
paul@15 | 140 | /* PCB supports. */ |
paul@15 | 141 | |
paul@15 | 142 | translate([-edge_connector_cutout_back_width / 2 + |
paul@15 | 143 | pcb_front_support_width / 2, |
paul@15 | 144 | -pcb_front_support_depth / 2, |
paul@15 | 145 | -height / 2 + bottom + bottom_from_base + |
paul@15 | 146 | pcb_front_support_height / 2]) |
paul@15 | 147 | cube([pcb_front_support_width, pcb_front_support_depth, |
paul@15 | 148 | pcb_front_support_height], center = true); |
paul@15 | 149 | |
paul@15 | 150 | translate([edge_connector_cutout_back_width / 2 - |
paul@15 | 151 | pcb_front_support_width / 2, |
paul@15 | 152 | -pcb_front_support_depth / 2, |
paul@15 | 153 | -height / 2 + bottom + bottom_from_base + |
paul@15 | 154 | pcb_front_support_height / 2]) |
paul@15 | 155 | cube([pcb_front_support_width, pcb_front_support_depth, |
paul@15 | 156 | pcb_front_support_height], center = true); |
paul@10 | 157 | } |
paul@10 | 158 | |
paul@10 | 159 | /* Label insets. */ |
paul@10 | 160 | |
paul@10 | 161 | union() { |
paul@10 | 162 | |
paul@10 | 163 | /* Front label. */ |
paul@10 | 164 | |
paul@10 | 165 | translate([-front_label_width / 2, -front_depth, |
paul@10 | 166 | front_label_offset_from_bottom - height / 2]) |
paul@10 | 167 | cube([front_label_width, front_label_depth, |
paul@10 | 168 | front_label_height]); |
paul@10 | 169 | |
paul@10 | 170 | /* Top label. */ |
paul@10 | 171 | |
paul@10 | 172 | translate([-top_label_width / 2, |
paul@10 | 173 | -front_depth + top_label_offset_from_front, |
paul@10 | 174 | height / 2 - top_label_depth]) |
paul@10 | 175 | cube([top_label_width, top_label_height, |
paul@10 | 176 | top_label_depth]); |
paul@10 | 177 | } |
paul@10 | 178 | |
paul@10 | 179 | /* Inner front edge cavity. */ |
paul@10 | 180 | |
paul@10 | 181 | translate([inner_front_edge_width / 2, |
paul@10 | 182 | -front_depth + inner_front_edge_offset, -height / 2]) |
paul@10 | 183 | rotate([0, -90, 0]) |
paul@10 | 184 | linear_extrude(height = inner_front_edge_width) |
paul@10 | 185 | polygon([ |
paul@10 | 186 | [-extra, 0], |
paul@10 | 187 | [0, 0], |
paul@10 | 188 | [inner_front_edge_height, inner_front_edge_depth], |
paul@10 | 189 | [-extra, inner_front_edge_depth], |
paul@10 | 190 | ]); |
paul@10 | 191 | |
paul@11 | 192 | /* Inner top cutout for the top of the back portion. */ |
paul@11 | 193 | |
paul@11 | 194 | translate([0, -inner_top_front_cutout_depth / 2, height / 2 - |
paul@11 | 195 | inner_top_front_cutout_offset - |
paul@11 | 196 | inner_top_front_cutout_depth / 2]) |
paul@11 | 197 | cube([inner_top_front_cutout_width, |
paul@11 | 198 | inner_top_front_cutout_depth, |
paul@11 | 199 | inner_top_front_cutout_depth], center = true); |
paul@11 | 200 | |
paul@10 | 201 | /* Fillets to round off the edges. */ |
paul@10 | 202 | |
paul@10 | 203 | union() { |
paul@10 | 204 | |
paul@10 | 205 | /* Top left and right rounding. */ |
paul@10 | 206 | |
paul@10 | 207 | translate([-width / 2 + ro, -front_depth / 2, height / 2 - ro]) |
paul@10 | 208 | rotate([0, 0, 180]) |
paul@10 | 209 | rotate([90, 0, 0]) |
paul@10 | 210 | fillet(rr, front_depth); |
paul@10 | 211 | translate([width / 2 - ro, -front_depth / 2, height / 2 - ro]) |
paul@10 | 212 | rotate([90, 0, 0]) |
paul@10 | 213 | fillet(rr, front_depth); |
paul@10 | 214 | |
paul@10 | 215 | /* Top front rounding. */ |
paul@10 | 216 | |
paul@10 | 217 | translate([0, -front_depth + ro, height / 2 - ro]) |
paul@10 | 218 | rotate([0, 0, 180]) |
paul@10 | 219 | rotate([0, -90, 0]) |
paul@10 | 220 | fillet(rr, width); |
paul@10 | 221 | |
paul@10 | 222 | /* Edge rounding. */ |
paul@10 | 223 | |
paul@10 | 224 | translate([-width / 2 + ro, -front_depth + ro, 0]) |
paul@10 | 225 | rotate([0, 0, 180]) |
paul@10 | 226 | fillet(rr, height); |
paul@10 | 227 | translate([width / 2 - ro, -front_depth + ro, 0]) |
paul@10 | 228 | rotate([0, 0, 270]) |
paul@10 | 229 | fillet(rr, height); |
paul@10 | 230 | } |
paul@10 | 231 | } |
paul@10 | 232 | |
paul@10 | 233 | difference() { |
paul@10 | 234 | |
paul@10 | 235 | /* The cartridge surfaces. */ |
paul@10 | 236 | |
paul@10 | 237 | union() { |
paul@8 | 238 | |
paul@8 | 239 | /* Back portion. */ |
paul@8 | 240 | |
paul@8 | 241 | translate([0, back_depth - back / 2, 0]) |
paul@0 | 242 | cube([width, back, height], center = true); |
paul@8 | 243 | translate([-width / 2 + back_left / 2, back_depth / 2, 0]) |
paul@8 | 244 | cube([back_left, back_depth, height], center = true); |
paul@8 | 245 | translate([width / 2 - back_right / 2, back_depth / 2, 0]) |
paul@8 | 246 | cube([back_right, back_depth, height], center = true); |
paul@8 | 247 | translate([0, back_depth / 2, height / 2 - top / 2]) |
paul@8 | 248 | cube([width, back_depth, top], center = true); |
paul@8 | 249 | difference() { |
paul@8 | 250 | translate([0, back_depth / 2, |
paul@8 | 251 | -height / 2 + bottom / 2 + bottom_from_base]) |
paul@8 | 252 | cube([width, back_depth, bottom], center = true); |
paul@8 | 253 | translate([0, edge_connector_cutout_back_depth / 2, |
paul@8 | 254 | -height / 2 + bottom / 2 + bottom_from_base]) |
paul@8 | 255 | cube([edge_connector_cutout_back_width, |
paul@8 | 256 | edge_connector_cutout_back_depth, |
paul@8 | 257 | bottom + extra], center = true); |
paul@8 | 258 | } |
paul@14 | 259 | |
paul@14 | 260 | /* PCB supports. */ |
paul@14 | 261 | |
paul@14 | 262 | translate([-edge_connector_cutout_back_width / 2 + |
paul@14 | 263 | pcb_back_support_width / 2, |
paul@14 | 264 | edge_connector_cutout_back_depth + |
paul@14 | 265 | pcb_back_support_depth / 2, |
paul@14 | 266 | -height / 2 + bottom + bottom_from_base + |
paul@14 | 267 | pcb_back_support_height / 2]) |
paul@14 | 268 | cube([pcb_back_support_width, pcb_back_support_depth, |
paul@14 | 269 | pcb_back_support_height], center = true); |
paul@14 | 270 | |
paul@14 | 271 | translate([edge_connector_cutout_back_width / 2 - |
paul@14 | 272 | pcb_back_support_width / 2, |
paul@14 | 273 | edge_connector_cutout_back_depth + |
paul@14 | 274 | pcb_back_support_depth / 2, |
paul@14 | 275 | -height / 2 + bottom + bottom_from_base + |
paul@14 | 276 | pcb_back_support_height / 2]) |
paul@14 | 277 | cube([pcb_back_support_width, pcb_back_support_depth, |
paul@14 | 278 | pcb_back_support_height], center = true); |
paul@0 | 279 | } |
paul@0 | 280 | |
paul@1 | 281 | /* Label insets. */ |
paul@1 | 282 | |
paul@1 | 283 | union() { |
paul@1 | 284 | |
paul@1 | 285 | /* Top label. */ |
paul@1 | 286 | |
paul@1 | 287 | translate([-top_label_width / 2, |
paul@8 | 288 | -front_depth + top_label_offset_from_front, |
paul@1 | 289 | height / 2 - top_label_depth]) |
paul@1 | 290 | cube([top_label_width, top_label_height, |
paul@1 | 291 | top_label_depth]); |
paul@1 | 292 | } |
paul@1 | 293 | |
paul@8 | 294 | /* Top and side grooves, positioned in the back portion. */ |
paul@2 | 295 | |
paul@2 | 296 | union() { |
paul@2 | 297 | |
paul@2 | 298 | /* Left groove. */ |
paul@2 | 299 | |
paul@8 | 300 | translate([-width / 2 + groove_depth / 2, groove_width / 2, 0]) |
paul@8 | 301 | cube([groove_depth, groove_width, height], |
paul@4 | 302 | center = true); |
paul@2 | 303 | |
paul@2 | 304 | /* Right groove. */ |
paul@2 | 305 | |
paul@8 | 306 | translate([width / 2 - groove_depth / 2, groove_width / 2, 0]) |
paul@8 | 307 | cube([groove_depth, groove_width, height], |
paul@4 | 308 | center = true); |
paul@2 | 309 | |
paul@8 | 310 | /* Top grooves. */ |
paul@2 | 311 | |
paul@8 | 312 | translate([0, groove_width / 2, height / 2 - groove_depth / 2]) |
paul@8 | 313 | cube([width, groove_width, groove_depth], |
paul@8 | 314 | center = true); |
paul@8 | 315 | |
paul@8 | 316 | translate([0, top_groove_width / 2, |
paul@8 | 317 | height / 2 - top_groove_depth / 2]) |
paul@8 | 318 | cube([width, top_groove_width, top_groove_depth], |
paul@4 | 319 | center = true); |
paul@4 | 320 | } |
paul@4 | 321 | |
paul@4 | 322 | /* Back cavity. */ |
paul@4 | 323 | |
paul@4 | 324 | intersection() { |
paul@4 | 325 | |
paul@4 | 326 | /* From the bottom upwards. */ |
paul@4 | 327 | |
paul@8 | 328 | translate([0, back_depth, -height / 2]) |
paul@4 | 329 | linear_extrude(height = back_cavity_height) |
paul@4 | 330 | translate([-width / 2, 0, 0]) |
paul@4 | 331 | polygon([ |
paul@4 | 332 | [back_cavity_offset_from_left, 0], |
paul@4 | 333 | [back_cavity_inner_offset_from_left, |
paul@4 | 334 | -back_cavity_depth], |
paul@4 | 335 | [back_cavity_inner_offset_from_left + |
paul@4 | 336 | back_cavity_inner_width, |
paul@4 | 337 | -back_cavity_depth], |
paul@4 | 338 | [back_cavity_offset_from_left + |
paul@4 | 339 | back_cavity_width, 0] |
paul@4 | 340 | ]); |
paul@4 | 341 | |
paul@4 | 342 | /* From left to right. */ |
paul@4 | 343 | |
paul@8 | 344 | translate([back_cavity_width / 2, back_depth, -height / 2]) |
paul@4 | 345 | rotate([0, -90, 0]) |
paul@4 | 346 | linear_extrude(height = back_cavity_width) |
paul@4 | 347 | polygon([ |
paul@4 | 348 | [-extra, -back_cavity_depth], |
paul@4 | 349 | [back_cavity_inner_height, |
paul@4 | 350 | -back_cavity_depth], |
paul@4 | 351 | [back_cavity_height, 0], |
paul@4 | 352 | [-extra, 0] |
paul@4 | 353 | ]); |
paul@2 | 354 | } |
paul@2 | 355 | |
paul@5 | 356 | /* Inner back cavities. */ |
paul@5 | 357 | |
paul@8 | 358 | translate([0, back_depth - inner_back_cavity_offset, -height / 2]) |
paul@5 | 359 | linear_extrude(height = bottom_from_base) |
paul@5 | 360 | translate([-width / 2, 0, 0]) |
paul@5 | 361 | polygon([ |
paul@5 | 362 | [inner_back_cavity_offset_from_left, 0], |
paul@5 | 363 | [inner_back_slope_offset_from_left, 0], |
paul@5 | 364 | [inner_back_slope_offset_from_left + |
paul@5 | 365 | inner_back_slope_width, |
paul@5 | 366 | -inner_back_slope_depth], |
paul@5 | 367 | [inner_back_cavity_offset_from_left, |
paul@5 | 368 | -inner_back_slope_depth] |
paul@5 | 369 | ]); |
paul@5 | 370 | |
paul@8 | 371 | translate([0, back_depth - inner_back_cavity_offset, -height / 2]) |
paul@5 | 372 | linear_extrude(height = bottom_from_base) |
paul@5 | 373 | translate([-width / 2, 0, 0]) |
paul@5 | 374 | polygon([ |
paul@5 | 375 | [width - inner_back_slope_offset_from_left, 0], |
paul@5 | 376 | [width - inner_back_cavity_offset_from_left, 0], |
paul@5 | 377 | [width - inner_back_cavity_offset_from_left, |
paul@5 | 378 | -inner_back_slope_depth], |
paul@5 | 379 | [width - inner_back_slope_offset_from_left - |
paul@5 | 380 | inner_back_slope_width, |
paul@5 | 381 | -inner_back_slope_depth] |
paul@5 | 382 | ]); |
paul@5 | 383 | |
paul@7 | 384 | /* Inner back edge cavity. */ |
paul@7 | 385 | |
paul@5 | 386 | translate([inner_back_edge_width / 2, |
paul@8 | 387 | back_depth - inner_back_edge_offset, -height / 2]) |
paul@5 | 388 | rotate([0, -90, 0]) |
paul@5 | 389 | linear_extrude(height = inner_back_edge_width) |
paul@5 | 390 | polygon([ |
paul@5 | 391 | [-extra, -inner_back_edge_depth], |
paul@5 | 392 | [inner_back_edge_height, -inner_back_edge_depth], |
paul@5 | 393 | [0, 0], |
paul@5 | 394 | [-extra, 0] |
paul@5 | 395 | ]); |
paul@5 | 396 | |
paul@1 | 397 | /* Fillets to round off the edges. */ |
paul@1 | 398 | |
paul@0 | 399 | union() { |
paul@0 | 400 | |
paul@0 | 401 | /* Top left and right rounding. */ |
paul@0 | 402 | |
paul@9 | 403 | translate([-width / 2 + ro, back_depth / 2, height / 2 - ro]) |
paul@9 | 404 | rotate([0, 0, 180]) |
paul@9 | 405 | rotate([90, 0, 0]) |
paul@9 | 406 | fillet(rr, back_depth); |
paul@9 | 407 | translate([width / 2 - ro, back_depth / 2, height / 2 - ro]) |
paul@9 | 408 | rotate([90, 0, 0]) |
paul@9 | 409 | fillet(rr, back_depth); |
paul@0 | 410 | |
paul@10 | 411 | /* Top back rounding. */ |
paul@0 | 412 | |
paul@8 | 413 | translate([0, back_depth - ro, height / 2 - ro]) |
paul@0 | 414 | rotate([0, -90, 0]) |
paul@3 | 415 | fillet(rr, width); |
paul@0 | 416 | |
paul@0 | 417 | /* Edge rounding. */ |
paul@0 | 418 | |
paul@8 | 419 | translate([width / 2 - ro, back_depth - ro, 0]) |
paul@3 | 420 | fillet(rr, height); |
paul@8 | 421 | translate([-width / 2 + ro, back_depth - ro, 0]) |
paul@0 | 422 | rotate([0, 0, 90]) |
paul@3 | 423 | fillet(rr, height); |
paul@0 | 424 | } |
paul@0 | 425 | } |
paul@0 | 426 | } |
paul@0 | 427 | |
paul@0 | 428 | cartridge(); |
paul@0 | 429 | |