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@0 | 92 | difference() { |
paul@1 | 93 | |
paul@1 | 94 | /* The cartridge surfaces. */ |
paul@1 | 95 | |
paul@0 | 96 | union() { |
paul@8 | 97 | |
paul@8 | 98 | /* Front portion. */ |
paul@8 | 99 | |
paul@8 | 100 | translate([0, -front_depth + front / 2, 0]) |
paul@0 | 101 | cube([width, front, height], center = true); |
paul@8 | 102 | translate([-width / 2 + front_left / 2, -front_depth / 2, 0]) |
paul@8 | 103 | cube([front_left, front_depth, height], center = true); |
paul@8 | 104 | translate([width / 2 - front_right / 2, -front_depth / 2, 0]) |
paul@8 | 105 | cube([front_right, front_depth, height], center = true); |
paul@8 | 106 | translate([0, -front_depth / 2, height / 2 - top / 2]) |
paul@8 | 107 | cube([width, front_depth, top], center = true); |
paul@8 | 108 | difference() { |
paul@8 | 109 | translate([0, -front_depth / 2, |
paul@8 | 110 | -height / 2 + bottom / 2 + bottom_from_base]) |
paul@8 | 111 | cube([width, front_depth, bottom], center = true); |
paul@8 | 112 | translate([-width / 2 + edge_connector_cutout_front_offset + |
paul@8 | 113 | edge_connector_cutout_front_width / 2, |
paul@8 | 114 | -edge_connector_cutout_front_depth / 2, |
paul@8 | 115 | -height / 2 + bottom / 2 + bottom_from_base]) |
paul@8 | 116 | cube([edge_connector_cutout_front_width, |
paul@8 | 117 | edge_connector_cutout_front_depth, |
paul@8 | 118 | bottom + extra], center = true); |
paul@8 | 119 | translate([width / 2 - edge_connector_cutout_front_offset - |
paul@8 | 120 | edge_connector_cutout_front_width / 2, |
paul@8 | 121 | -edge_connector_cutout_front_depth / 2, |
paul@8 | 122 | -height / 2 + bottom / 2 + bottom_from_base]) |
paul@8 | 123 | cube([edge_connector_cutout_front_width, |
paul@8 | 124 | edge_connector_cutout_front_depth, |
paul@8 | 125 | bottom + extra], center = true); |
paul@8 | 126 | } |
paul@10 | 127 | } |
paul@10 | 128 | |
paul@10 | 129 | /* Label insets. */ |
paul@10 | 130 | |
paul@10 | 131 | union() { |
paul@10 | 132 | |
paul@10 | 133 | /* Front label. */ |
paul@10 | 134 | |
paul@10 | 135 | translate([-front_label_width / 2, -front_depth, |
paul@10 | 136 | front_label_offset_from_bottom - height / 2]) |
paul@10 | 137 | cube([front_label_width, front_label_depth, |
paul@10 | 138 | front_label_height]); |
paul@10 | 139 | |
paul@10 | 140 | /* Top label. */ |
paul@10 | 141 | |
paul@10 | 142 | translate([-top_label_width / 2, |
paul@10 | 143 | -front_depth + top_label_offset_from_front, |
paul@10 | 144 | height / 2 - top_label_depth]) |
paul@10 | 145 | cube([top_label_width, top_label_height, |
paul@10 | 146 | top_label_depth]); |
paul@10 | 147 | } |
paul@10 | 148 | |
paul@10 | 149 | /* Inner front edge cavity. */ |
paul@10 | 150 | |
paul@10 | 151 | translate([inner_front_edge_width / 2, |
paul@10 | 152 | -front_depth + inner_front_edge_offset, -height / 2]) |
paul@10 | 153 | rotate([0, -90, 0]) |
paul@10 | 154 | linear_extrude(height = inner_front_edge_width) |
paul@10 | 155 | polygon([ |
paul@10 | 156 | [-extra, 0], |
paul@10 | 157 | [0, 0], |
paul@10 | 158 | [inner_front_edge_height, inner_front_edge_depth], |
paul@10 | 159 | [-extra, inner_front_edge_depth], |
paul@10 | 160 | ]); |
paul@10 | 161 | |
paul@11 | 162 | /* Inner top cutout for the top of the back portion. */ |
paul@11 | 163 | |
paul@11 | 164 | translate([0, -inner_top_front_cutout_depth / 2, height / 2 - |
paul@11 | 165 | inner_top_front_cutout_offset - |
paul@11 | 166 | inner_top_front_cutout_depth / 2]) |
paul@11 | 167 | cube([inner_top_front_cutout_width, |
paul@11 | 168 | inner_top_front_cutout_depth, |
paul@11 | 169 | inner_top_front_cutout_depth], center = true); |
paul@11 | 170 | |
paul@10 | 171 | /* Fillets to round off the edges. */ |
paul@10 | 172 | |
paul@10 | 173 | union() { |
paul@10 | 174 | |
paul@10 | 175 | /* Top left and right rounding. */ |
paul@10 | 176 | |
paul@10 | 177 | translate([-width / 2 + ro, -front_depth / 2, height / 2 - ro]) |
paul@10 | 178 | rotate([0, 0, 180]) |
paul@10 | 179 | rotate([90, 0, 0]) |
paul@10 | 180 | fillet(rr, front_depth); |
paul@10 | 181 | translate([width / 2 - ro, -front_depth / 2, height / 2 - ro]) |
paul@10 | 182 | rotate([90, 0, 0]) |
paul@10 | 183 | fillet(rr, front_depth); |
paul@10 | 184 | |
paul@10 | 185 | /* Top front rounding. */ |
paul@10 | 186 | |
paul@10 | 187 | translate([0, -front_depth + ro, height / 2 - ro]) |
paul@10 | 188 | rotate([0, 0, 180]) |
paul@10 | 189 | rotate([0, -90, 0]) |
paul@10 | 190 | fillet(rr, width); |
paul@10 | 191 | |
paul@10 | 192 | /* Edge rounding. */ |
paul@10 | 193 | |
paul@10 | 194 | translate([-width / 2 + ro, -front_depth + ro, 0]) |
paul@10 | 195 | rotate([0, 0, 180]) |
paul@10 | 196 | fillet(rr, height); |
paul@10 | 197 | translate([width / 2 - ro, -front_depth + ro, 0]) |
paul@10 | 198 | rotate([0, 0, 270]) |
paul@10 | 199 | fillet(rr, height); |
paul@10 | 200 | } |
paul@10 | 201 | } |
paul@10 | 202 | |
paul@10 | 203 | difference() { |
paul@10 | 204 | |
paul@10 | 205 | /* The cartridge surfaces. */ |
paul@10 | 206 | |
paul@10 | 207 | union() { |
paul@8 | 208 | |
paul@8 | 209 | /* Back portion. */ |
paul@8 | 210 | |
paul@8 | 211 | translate([0, back_depth - back / 2, 0]) |
paul@0 | 212 | cube([width, back, height], center = true); |
paul@8 | 213 | translate([-width / 2 + back_left / 2, back_depth / 2, 0]) |
paul@8 | 214 | cube([back_left, back_depth, height], center = true); |
paul@8 | 215 | translate([width / 2 - back_right / 2, back_depth / 2, 0]) |
paul@8 | 216 | cube([back_right, back_depth, height], center = true); |
paul@8 | 217 | translate([0, back_depth / 2, height / 2 - top / 2]) |
paul@8 | 218 | cube([width, back_depth, top], center = true); |
paul@8 | 219 | difference() { |
paul@8 | 220 | translate([0, back_depth / 2, |
paul@8 | 221 | -height / 2 + bottom / 2 + bottom_from_base]) |
paul@8 | 222 | cube([width, back_depth, bottom], center = true); |
paul@8 | 223 | translate([0, edge_connector_cutout_back_depth / 2, |
paul@8 | 224 | -height / 2 + bottom / 2 + bottom_from_base]) |
paul@8 | 225 | cube([edge_connector_cutout_back_width, |
paul@8 | 226 | edge_connector_cutout_back_depth, |
paul@8 | 227 | bottom + extra], center = true); |
paul@8 | 228 | } |
paul@0 | 229 | } |
paul@0 | 230 | |
paul@1 | 231 | /* Label insets. */ |
paul@1 | 232 | |
paul@1 | 233 | union() { |
paul@1 | 234 | |
paul@1 | 235 | /* Top label. */ |
paul@1 | 236 | |
paul@1 | 237 | translate([-top_label_width / 2, |
paul@8 | 238 | -front_depth + top_label_offset_from_front, |
paul@1 | 239 | height / 2 - top_label_depth]) |
paul@1 | 240 | cube([top_label_width, top_label_height, |
paul@1 | 241 | top_label_depth]); |
paul@1 | 242 | } |
paul@1 | 243 | |
paul@8 | 244 | /* Top and side grooves, positioned in the back portion. */ |
paul@2 | 245 | |
paul@2 | 246 | union() { |
paul@2 | 247 | |
paul@2 | 248 | /* Left groove. */ |
paul@2 | 249 | |
paul@8 | 250 | translate([-width / 2 + groove_depth / 2, groove_width / 2, 0]) |
paul@8 | 251 | cube([groove_depth, groove_width, height], |
paul@4 | 252 | center = true); |
paul@2 | 253 | |
paul@2 | 254 | /* Right groove. */ |
paul@2 | 255 | |
paul@8 | 256 | translate([width / 2 - groove_depth / 2, groove_width / 2, 0]) |
paul@8 | 257 | cube([groove_depth, groove_width, height], |
paul@4 | 258 | center = true); |
paul@2 | 259 | |
paul@8 | 260 | /* Top grooves. */ |
paul@2 | 261 | |
paul@8 | 262 | translate([0, groove_width / 2, height / 2 - groove_depth / 2]) |
paul@8 | 263 | cube([width, groove_width, groove_depth], |
paul@8 | 264 | center = true); |
paul@8 | 265 | |
paul@8 | 266 | translate([0, top_groove_width / 2, |
paul@8 | 267 | height / 2 - top_groove_depth / 2]) |
paul@8 | 268 | cube([width, top_groove_width, top_groove_depth], |
paul@4 | 269 | center = true); |
paul@4 | 270 | } |
paul@4 | 271 | |
paul@4 | 272 | /* Back cavity. */ |
paul@4 | 273 | |
paul@4 | 274 | intersection() { |
paul@4 | 275 | |
paul@4 | 276 | /* From the bottom upwards. */ |
paul@4 | 277 | |
paul@8 | 278 | translate([0, back_depth, -height / 2]) |
paul@4 | 279 | linear_extrude(height = back_cavity_height) |
paul@4 | 280 | translate([-width / 2, 0, 0]) |
paul@4 | 281 | polygon([ |
paul@4 | 282 | [back_cavity_offset_from_left, 0], |
paul@4 | 283 | [back_cavity_inner_offset_from_left, |
paul@4 | 284 | -back_cavity_depth], |
paul@4 | 285 | [back_cavity_inner_offset_from_left + |
paul@4 | 286 | back_cavity_inner_width, |
paul@4 | 287 | -back_cavity_depth], |
paul@4 | 288 | [back_cavity_offset_from_left + |
paul@4 | 289 | back_cavity_width, 0] |
paul@4 | 290 | ]); |
paul@4 | 291 | |
paul@4 | 292 | /* From left to right. */ |
paul@4 | 293 | |
paul@8 | 294 | translate([back_cavity_width / 2, back_depth, -height / 2]) |
paul@4 | 295 | rotate([0, -90, 0]) |
paul@4 | 296 | linear_extrude(height = back_cavity_width) |
paul@4 | 297 | polygon([ |
paul@4 | 298 | [-extra, -back_cavity_depth], |
paul@4 | 299 | [back_cavity_inner_height, |
paul@4 | 300 | -back_cavity_depth], |
paul@4 | 301 | [back_cavity_height, 0], |
paul@4 | 302 | [-extra, 0] |
paul@4 | 303 | ]); |
paul@2 | 304 | } |
paul@2 | 305 | |
paul@5 | 306 | /* Inner back cavities. */ |
paul@5 | 307 | |
paul@8 | 308 | translate([0, back_depth - inner_back_cavity_offset, -height / 2]) |
paul@5 | 309 | linear_extrude(height = bottom_from_base) |
paul@5 | 310 | translate([-width / 2, 0, 0]) |
paul@5 | 311 | polygon([ |
paul@5 | 312 | [inner_back_cavity_offset_from_left, 0], |
paul@5 | 313 | [inner_back_slope_offset_from_left, 0], |
paul@5 | 314 | [inner_back_slope_offset_from_left + |
paul@5 | 315 | inner_back_slope_width, |
paul@5 | 316 | -inner_back_slope_depth], |
paul@5 | 317 | [inner_back_cavity_offset_from_left, |
paul@5 | 318 | -inner_back_slope_depth] |
paul@5 | 319 | ]); |
paul@5 | 320 | |
paul@8 | 321 | translate([0, back_depth - inner_back_cavity_offset, -height / 2]) |
paul@5 | 322 | linear_extrude(height = bottom_from_base) |
paul@5 | 323 | translate([-width / 2, 0, 0]) |
paul@5 | 324 | polygon([ |
paul@5 | 325 | [width - inner_back_slope_offset_from_left, 0], |
paul@5 | 326 | [width - inner_back_cavity_offset_from_left, 0], |
paul@5 | 327 | [width - inner_back_cavity_offset_from_left, |
paul@5 | 328 | -inner_back_slope_depth], |
paul@5 | 329 | [width - inner_back_slope_offset_from_left - |
paul@5 | 330 | inner_back_slope_width, |
paul@5 | 331 | -inner_back_slope_depth] |
paul@5 | 332 | ]); |
paul@5 | 333 | |
paul@7 | 334 | /* Inner back edge cavity. */ |
paul@7 | 335 | |
paul@5 | 336 | translate([inner_back_edge_width / 2, |
paul@8 | 337 | back_depth - inner_back_edge_offset, -height / 2]) |
paul@5 | 338 | rotate([0, -90, 0]) |
paul@5 | 339 | linear_extrude(height = inner_back_edge_width) |
paul@5 | 340 | polygon([ |
paul@5 | 341 | [-extra, -inner_back_edge_depth], |
paul@5 | 342 | [inner_back_edge_height, -inner_back_edge_depth], |
paul@5 | 343 | [0, 0], |
paul@5 | 344 | [-extra, 0] |
paul@5 | 345 | ]); |
paul@5 | 346 | |
paul@1 | 347 | /* Fillets to round off the edges. */ |
paul@1 | 348 | |
paul@0 | 349 | union() { |
paul@0 | 350 | |
paul@0 | 351 | /* Top left and right rounding. */ |
paul@0 | 352 | |
paul@9 | 353 | translate([-width / 2 + ro, back_depth / 2, height / 2 - ro]) |
paul@9 | 354 | rotate([0, 0, 180]) |
paul@9 | 355 | rotate([90, 0, 0]) |
paul@9 | 356 | fillet(rr, back_depth); |
paul@9 | 357 | translate([width / 2 - ro, back_depth / 2, height / 2 - ro]) |
paul@9 | 358 | rotate([90, 0, 0]) |
paul@9 | 359 | fillet(rr, back_depth); |
paul@0 | 360 | |
paul@10 | 361 | /* Top back rounding. */ |
paul@0 | 362 | |
paul@8 | 363 | translate([0, back_depth - ro, height / 2 - ro]) |
paul@0 | 364 | rotate([0, -90, 0]) |
paul@3 | 365 | fillet(rr, width); |
paul@0 | 366 | |
paul@0 | 367 | /* Edge rounding. */ |
paul@0 | 368 | |
paul@8 | 369 | translate([width / 2 - ro, back_depth - ro, 0]) |
paul@3 | 370 | fillet(rr, height); |
paul@8 | 371 | translate([-width / 2 + ro, back_depth - ro, 0]) |
paul@0 | 372 | rotate([0, 0, 90]) |
paul@3 | 373 | fillet(rr, height); |
paul@0 | 374 | } |
paul@0 | 375 | } |
paul@0 | 376 | } |
paul@0 | 377 | |
paul@0 | 378 | cartridge(); |
paul@0 | 379 | |