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@0 | 26 | |
paul@1 | 27 | /* Details. */ |
paul@1 | 28 | |
paul@1 | 29 | front_label_width = 83.0; |
paul@1 | 30 | front_label_height = 46.0; |
paul@1 | 31 | front_label_depth = 1.0; |
paul@1 | 32 | front_label_offset_from_bottom = 19.5; |
paul@3 | 33 | |
paul@1 | 34 | top_label_width = front_label_width; |
paul@1 | 35 | top_label_height = 11.5; |
paul@1 | 36 | top_label_depth = front_label_depth; |
paul@1 | 37 | top_label_offset_from_front = 2.5; |
paul@3 | 38 | |
paul@2 | 39 | groove_depth = 1.0; |
paul@1 | 40 | |
paul@4 | 41 | back_cavity_width = 68.0; |
paul@4 | 42 | back_cavity_inner_width = 65.0; |
paul@4 | 43 | back_cavity_offset_from_left = 10.5; |
paul@4 | 44 | back_cavity_inner_offset_from_left = 12.0; |
paul@4 | 45 | back_cavity_height = 13.5; |
paul@4 | 46 | back_cavity_inner_height = 12.0; |
paul@4 | 47 | back_cavity_depth = 1.5; |
paul@4 | 48 | |
paul@6 | 49 | inner_back_cavity_offset = 1.0; |
paul@5 | 50 | inner_back_cavity_offset_from_left = 2.0; |
paul@5 | 51 | inner_back_slope_offset_from_left = 10.0; |
paul@5 | 52 | inner_back_slope_width = 2.5; |
paul@6 | 53 | inner_back_slope_depth = 2.5; |
paul@5 | 54 | |
paul@5 | 55 | inner_back_edge_offset = 2.0; |
paul@5 | 56 | inner_back_edge_width = 69.0; |
paul@5 | 57 | inner_back_edge_height = 3.0; |
paul@5 | 58 | inner_back_edge_depth = 1.5; |
paul@5 | 59 | |
paul@5 | 60 | bottom_from_base = 13.5; |
paul@5 | 61 | |
paul@0 | 62 | /* Side thicknesses. */ |
paul@0 | 63 | |
paul@0 | 64 | front = 2; |
paul@0 | 65 | back = 3.5; |
paul@0 | 66 | top = 3; |
paul@0 | 67 | left = 2; |
paul@0 | 68 | right = 2; |
paul@5 | 69 | bottom = 2; |
paul@0 | 70 | |
paul@0 | 71 | difference() { |
paul@1 | 72 | |
paul@1 | 73 | /* The cartridge surfaces. */ |
paul@1 | 74 | |
paul@0 | 75 | union() { |
paul@0 | 76 | translate([0, -depth / 2 + front / 2, 0]) |
paul@0 | 77 | cube([width, front, height], center = true); |
paul@0 | 78 | translate([0, depth / 2 - back / 2, 0]) |
paul@0 | 79 | cube([width, back, height], center = true); |
paul@0 | 80 | translate([-width / 2 + left / 2, 0, 0]) |
paul@0 | 81 | cube([left, depth, height], center = true); |
paul@0 | 82 | translate([width / 2 - right / 2, 0, 0]) |
paul@0 | 83 | cube([right, depth, height], center = true); |
paul@0 | 84 | translate([0, 0, height / 2 - top / 2]) |
paul@0 | 85 | cube([width, depth, top], center = true); |
paul@5 | 86 | translate([0, 0, -height / 2 + bottom / 2 + bottom_from_base]) |
paul@5 | 87 | cube([width, depth, top], center = true); |
paul@0 | 88 | } |
paul@0 | 89 | |
paul@1 | 90 | /* Label insets. */ |
paul@1 | 91 | |
paul@1 | 92 | union() { |
paul@1 | 93 | |
paul@1 | 94 | /* Front label. */ |
paul@1 | 95 | |
paul@1 | 96 | translate([-front_label_width / 2, -depth / 2, |
paul@1 | 97 | front_label_offset_from_bottom - height / 2]) |
paul@1 | 98 | cube([front_label_width, front_label_depth, |
paul@1 | 99 | front_label_height]); |
paul@1 | 100 | |
paul@1 | 101 | /* Top label. */ |
paul@1 | 102 | |
paul@1 | 103 | translate([-top_label_width / 2, |
paul@1 | 104 | -depth / 2 + top_label_offset_from_front, |
paul@1 | 105 | height / 2 - top_label_depth]) |
paul@1 | 106 | cube([top_label_width, top_label_height, |
paul@1 | 107 | top_label_depth]); |
paul@1 | 108 | } |
paul@1 | 109 | |
paul@2 | 110 | /* Top and side grooves. */ |
paul@2 | 111 | |
paul@2 | 112 | union() { |
paul@2 | 113 | |
paul@2 | 114 | /* Left groove. */ |
paul@2 | 115 | |
paul@2 | 116 | translate([-width / 2 + groove_depth / 2, 0, 0]) |
paul@4 | 117 | cube([groove_depth, groove_depth, height], |
paul@4 | 118 | center = true); |
paul@2 | 119 | |
paul@2 | 120 | /* Right groove. */ |
paul@2 | 121 | |
paul@2 | 122 | translate([width / 2 - groove_depth / 2, 0, 0]) |
paul@4 | 123 | cube([groove_depth, groove_depth, height], |
paul@4 | 124 | center = true); |
paul@2 | 125 | |
paul@2 | 126 | /* Top groove. */ |
paul@2 | 127 | |
paul@2 | 128 | translate([0, 0, height / 2 - groove_depth / 2]) |
paul@4 | 129 | cube([width, groove_depth, groove_depth], |
paul@4 | 130 | center = true); |
paul@4 | 131 | } |
paul@4 | 132 | |
paul@4 | 133 | /* Back cavity. */ |
paul@4 | 134 | |
paul@4 | 135 | intersection() { |
paul@4 | 136 | |
paul@4 | 137 | /* From the bottom upwards. */ |
paul@4 | 138 | |
paul@4 | 139 | translate([0, depth / 2, -height / 2]) |
paul@4 | 140 | linear_extrude(height = back_cavity_height) |
paul@4 | 141 | translate([-width / 2, 0, 0]) |
paul@4 | 142 | polygon([ |
paul@4 | 143 | [back_cavity_offset_from_left, 0], |
paul@4 | 144 | [back_cavity_inner_offset_from_left, |
paul@4 | 145 | -back_cavity_depth], |
paul@4 | 146 | [back_cavity_inner_offset_from_left + |
paul@4 | 147 | back_cavity_inner_width, |
paul@4 | 148 | -back_cavity_depth], |
paul@4 | 149 | [back_cavity_offset_from_left + |
paul@4 | 150 | back_cavity_width, 0] |
paul@4 | 151 | ]); |
paul@4 | 152 | |
paul@4 | 153 | /* From left to right. */ |
paul@4 | 154 | |
paul@4 | 155 | translate([back_cavity_width / 2, depth / 2, -height / 2]) |
paul@4 | 156 | rotate([0, -90, 0]) |
paul@4 | 157 | linear_extrude(height = back_cavity_width) |
paul@4 | 158 | polygon([ |
paul@4 | 159 | [-extra, -back_cavity_depth], |
paul@4 | 160 | [back_cavity_inner_height, |
paul@4 | 161 | -back_cavity_depth], |
paul@4 | 162 | [back_cavity_height, 0], |
paul@4 | 163 | [-extra, 0] |
paul@4 | 164 | ]); |
paul@2 | 165 | } |
paul@2 | 166 | |
paul@5 | 167 | /* Inner back cavities. */ |
paul@5 | 168 | |
paul@5 | 169 | translate([0, depth / 2 - inner_back_cavity_offset, -height / 2]) |
paul@5 | 170 | linear_extrude(height = bottom_from_base) |
paul@5 | 171 | translate([-width / 2, 0, 0]) |
paul@5 | 172 | polygon([ |
paul@5 | 173 | [inner_back_cavity_offset_from_left, 0], |
paul@5 | 174 | [inner_back_slope_offset_from_left, 0], |
paul@5 | 175 | [inner_back_slope_offset_from_left + |
paul@5 | 176 | inner_back_slope_width, |
paul@5 | 177 | -inner_back_slope_depth], |
paul@5 | 178 | [inner_back_cavity_offset_from_left, |
paul@5 | 179 | -inner_back_slope_depth] |
paul@5 | 180 | ]); |
paul@5 | 181 | |
paul@5 | 182 | translate([0, depth / 2 - inner_back_cavity_offset, -height / 2]) |
paul@5 | 183 | linear_extrude(height = bottom_from_base) |
paul@5 | 184 | translate([-width / 2, 0, 0]) |
paul@5 | 185 | polygon([ |
paul@5 | 186 | [width - inner_back_slope_offset_from_left, 0], |
paul@5 | 187 | [width - inner_back_cavity_offset_from_left, 0], |
paul@5 | 188 | [width - inner_back_cavity_offset_from_left, |
paul@5 | 189 | -inner_back_slope_depth], |
paul@5 | 190 | [width - inner_back_slope_offset_from_left - |
paul@5 | 191 | inner_back_slope_width, |
paul@5 | 192 | -inner_back_slope_depth] |
paul@5 | 193 | ]); |
paul@5 | 194 | |
paul@5 | 195 | translate([inner_back_edge_width / 2, |
paul@5 | 196 | depth / 2 - inner_back_edge_offset, -height / 2]) |
paul@5 | 197 | rotate([0, -90, 0]) |
paul@5 | 198 | linear_extrude(height = inner_back_edge_width) |
paul@5 | 199 | polygon([ |
paul@5 | 200 | [-extra, -inner_back_edge_depth], |
paul@5 | 201 | [0, -inner_back_edge_depth], |
paul@5 | 202 | [inner_back_edge_height, -inner_back_edge_depth], |
paul@5 | 203 | [0, 0], |
paul@5 | 204 | [-extra, 0] |
paul@5 | 205 | ]); |
paul@5 | 206 | |
paul@1 | 207 | /* Fillets to round off the edges. */ |
paul@1 | 208 | |
paul@0 | 209 | union() { |
paul@0 | 210 | |
paul@0 | 211 | /* Top left and right rounding. */ |
paul@0 | 212 | |
paul@0 | 213 | translate([-width / 2 + ro, 0, height / 2 - ro]) |
paul@0 | 214 | rotate([0, 0, 180]) |
paul@0 | 215 | rotate([90, 0, 0]) |
paul@3 | 216 | fillet(rr, depth); |
paul@0 | 217 | translate([width / 2 - ro, 0, height / 2 - ro]) |
paul@0 | 218 | rotate([90, 0, 0]) |
paul@3 | 219 | fillet(rr, depth); |
paul@0 | 220 | |
paul@0 | 221 | /* Top back and front rounding. */ |
paul@0 | 222 | |
paul@0 | 223 | translate([0, depth / 2 - ro, height / 2 - ro]) |
paul@0 | 224 | rotate([0, -90, 0]) |
paul@3 | 225 | fillet(rr, width); |
paul@0 | 226 | translate([0, -depth / 2 + ro, height / 2 - ro]) |
paul@0 | 227 | rotate([0, 0, 180]) |
paul@0 | 228 | rotate([0, -90, 0]) |
paul@3 | 229 | fillet(rr, width); |
paul@0 | 230 | |
paul@0 | 231 | /* Edge rounding. */ |
paul@0 | 232 | |
paul@0 | 233 | translate([width / 2 - ro, depth / 2 - ro, 0]) |
paul@3 | 234 | fillet(rr, height); |
paul@0 | 235 | translate([-width / 2 + ro, depth / 2 - ro, 0]) |
paul@0 | 236 | rotate([0, 0, 90]) |
paul@3 | 237 | fillet(rr, height); |
paul@0 | 238 | translate([-width / 2 + ro, -depth / 2 + ro, 0]) |
paul@0 | 239 | rotate([0, 0, 180]) |
paul@3 | 240 | fillet(rr, height); |
paul@0 | 241 | translate([width / 2 - ro, -depth / 2 + ro, 0]) |
paul@0 | 242 | rotate([0, 0, 270]) |
paul@3 | 243 | fillet(rr, height); |
paul@0 | 244 | } |
paul@0 | 245 | } |
paul@0 | 246 | } |
paul@0 | 247 | |
paul@0 | 248 | cartridge(); |
paul@0 | 249 | |