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@0 | 49 | /* Side thicknesses. */ |
paul@0 | 50 | |
paul@0 | 51 | front = 2; |
paul@0 | 52 | back = 3.5; |
paul@0 | 53 | top = 3; |
paul@0 | 54 | left = 2; |
paul@0 | 55 | right = 2; |
paul@0 | 56 | |
paul@0 | 57 | difference() { |
paul@1 | 58 | |
paul@1 | 59 | /* The cartridge surfaces. */ |
paul@1 | 60 | |
paul@0 | 61 | union() { |
paul@0 | 62 | translate([0, -depth / 2 + front / 2, 0]) |
paul@0 | 63 | cube([width, front, height], center = true); |
paul@0 | 64 | translate([0, depth / 2 - back / 2, 0]) |
paul@0 | 65 | cube([width, back, height], center = true); |
paul@0 | 66 | translate([-width / 2 + left / 2, 0, 0]) |
paul@0 | 67 | cube([left, depth, height], center = true); |
paul@0 | 68 | translate([width / 2 - right / 2, 0, 0]) |
paul@0 | 69 | cube([right, depth, height], center = true); |
paul@0 | 70 | translate([0, 0, height / 2 - top / 2]) |
paul@0 | 71 | cube([width, depth, top], center = true); |
paul@0 | 72 | } |
paul@0 | 73 | |
paul@1 | 74 | /* Label insets. */ |
paul@1 | 75 | |
paul@1 | 76 | union() { |
paul@1 | 77 | |
paul@1 | 78 | /* Front label. */ |
paul@1 | 79 | |
paul@1 | 80 | translate([-front_label_width / 2, -depth / 2, |
paul@1 | 81 | front_label_offset_from_bottom - height / 2]) |
paul@1 | 82 | cube([front_label_width, front_label_depth, |
paul@1 | 83 | front_label_height]); |
paul@1 | 84 | |
paul@1 | 85 | /* Top label. */ |
paul@1 | 86 | |
paul@1 | 87 | translate([-top_label_width / 2, |
paul@1 | 88 | -depth / 2 + top_label_offset_from_front, |
paul@1 | 89 | height / 2 - top_label_depth]) |
paul@1 | 90 | cube([top_label_width, top_label_height, |
paul@1 | 91 | top_label_depth]); |
paul@1 | 92 | } |
paul@1 | 93 | |
paul@2 | 94 | /* Top and side grooves. */ |
paul@2 | 95 | |
paul@2 | 96 | union() { |
paul@2 | 97 | |
paul@2 | 98 | /* Left groove. */ |
paul@2 | 99 | |
paul@2 | 100 | translate([-width / 2 + groove_depth / 2, 0, 0]) |
paul@4 | 101 | cube([groove_depth, groove_depth, height], |
paul@4 | 102 | center = true); |
paul@2 | 103 | |
paul@2 | 104 | /* Right groove. */ |
paul@2 | 105 | |
paul@2 | 106 | translate([width / 2 - groove_depth / 2, 0, 0]) |
paul@4 | 107 | cube([groove_depth, groove_depth, height], |
paul@4 | 108 | center = true); |
paul@2 | 109 | |
paul@2 | 110 | /* Top groove. */ |
paul@2 | 111 | |
paul@2 | 112 | translate([0, 0, height / 2 - groove_depth / 2]) |
paul@4 | 113 | cube([width, groove_depth, groove_depth], |
paul@4 | 114 | center = true); |
paul@4 | 115 | } |
paul@4 | 116 | |
paul@4 | 117 | /* Back cavity. */ |
paul@4 | 118 | |
paul@4 | 119 | intersection() { |
paul@4 | 120 | |
paul@4 | 121 | /* From the bottom upwards. */ |
paul@4 | 122 | |
paul@4 | 123 | translate([0, depth / 2, -height / 2]) |
paul@4 | 124 | linear_extrude(height = back_cavity_height) |
paul@4 | 125 | translate([-width / 2, 0, 0]) |
paul@4 | 126 | polygon([ |
paul@4 | 127 | [back_cavity_offset_from_left, 0], |
paul@4 | 128 | [back_cavity_inner_offset_from_left, |
paul@4 | 129 | -back_cavity_depth], |
paul@4 | 130 | [back_cavity_inner_offset_from_left + |
paul@4 | 131 | back_cavity_inner_width, |
paul@4 | 132 | -back_cavity_depth], |
paul@4 | 133 | [back_cavity_offset_from_left + |
paul@4 | 134 | back_cavity_width, 0] |
paul@4 | 135 | ]); |
paul@4 | 136 | |
paul@4 | 137 | /* From left to right. */ |
paul@4 | 138 | |
paul@4 | 139 | translate([back_cavity_width / 2, depth / 2, -height / 2]) |
paul@4 | 140 | rotate([0, -90, 0]) |
paul@4 | 141 | linear_extrude(height = back_cavity_width) |
paul@4 | 142 | polygon([ |
paul@4 | 143 | [-extra, -back_cavity_depth], |
paul@4 | 144 | [back_cavity_inner_height, |
paul@4 | 145 | -back_cavity_depth], |
paul@4 | 146 | [back_cavity_height, 0], |
paul@4 | 147 | [-extra, 0] |
paul@4 | 148 | ]); |
paul@2 | 149 | } |
paul@2 | 150 | |
paul@1 | 151 | /* Fillets to round off the edges. */ |
paul@1 | 152 | |
paul@0 | 153 | union() { |
paul@0 | 154 | |
paul@0 | 155 | /* Top left and right rounding. */ |
paul@0 | 156 | |
paul@0 | 157 | translate([-width / 2 + ro, 0, height / 2 - ro]) |
paul@0 | 158 | rotate([0, 0, 180]) |
paul@0 | 159 | rotate([90, 0, 0]) |
paul@3 | 160 | fillet(rr, depth); |
paul@0 | 161 | translate([width / 2 - ro, 0, height / 2 - ro]) |
paul@0 | 162 | rotate([90, 0, 0]) |
paul@3 | 163 | fillet(rr, depth); |
paul@0 | 164 | |
paul@0 | 165 | /* Top back and front rounding. */ |
paul@0 | 166 | |
paul@0 | 167 | translate([0, depth / 2 - ro, height / 2 - ro]) |
paul@0 | 168 | rotate([0, -90, 0]) |
paul@3 | 169 | fillet(rr, width); |
paul@0 | 170 | translate([0, -depth / 2 + ro, height / 2 - ro]) |
paul@0 | 171 | rotate([0, 0, 180]) |
paul@0 | 172 | rotate([0, -90, 0]) |
paul@3 | 173 | fillet(rr, width); |
paul@0 | 174 | |
paul@0 | 175 | /* Edge rounding. */ |
paul@0 | 176 | |
paul@0 | 177 | translate([width / 2 - ro, depth / 2 - ro, 0]) |
paul@3 | 178 | fillet(rr, height); |
paul@0 | 179 | translate([-width / 2 + ro, depth / 2 - ro, 0]) |
paul@0 | 180 | rotate([0, 0, 90]) |
paul@3 | 181 | fillet(rr, height); |
paul@0 | 182 | translate([-width / 2 + ro, -depth / 2 + ro, 0]) |
paul@0 | 183 | rotate([0, 0, 180]) |
paul@3 | 184 | fillet(rr, height); |
paul@0 | 185 | translate([width / 2 - ro, -depth / 2 + ro, 0]) |
paul@0 | 186 | rotate([0, 0, 270]) |
paul@3 | 187 | fillet(rr, height); |
paul@0 | 188 | } |
paul@0 | 189 | } |
paul@0 | 190 | } |
paul@0 | 191 | |
paul@0 | 192 | cartridge(); |
paul@0 | 193 | |