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