paul@0 | 1 | module cartridge() |
paul@0 | 2 | { |
paul@0 | 3 | $fn = 50; |
paul@0 | 4 | |
paul@0 | 5 | module fillet(r, h) { |
paul@0 | 6 | translate([0, 0, -h/2]) |
paul@0 | 7 | difference() { |
paul@0 | 8 | cube([r, r, h]); |
paul@0 | 9 | cylinder(r = r, h = h); |
paul@0 | 10 | } |
paul@0 | 11 | } |
paul@0 | 12 | |
paul@0 | 13 | /* Cartridge dimensions. */ |
paul@0 | 14 | |
paul@0 | 15 | width = 89.0; |
paul@0 | 16 | height = 68.5; |
paul@0 | 17 | depth = 16.5; |
paul@0 | 18 | |
paul@1 | 19 | /* Details. */ |
paul@1 | 20 | |
paul@1 | 21 | front_label_width = 83.0; |
paul@1 | 22 | front_label_height = 46.0; |
paul@1 | 23 | front_label_depth = 1.0; |
paul@1 | 24 | front_label_offset_from_bottom = 19.5; |
paul@1 | 25 | top_label_width = front_label_width; |
paul@1 | 26 | top_label_height = 11.5; |
paul@1 | 27 | top_label_depth = front_label_depth; |
paul@1 | 28 | top_label_offset_from_front = 2.5; |
paul@2 | 29 | groove_depth = 1.0; |
paul@1 | 30 | |
paul@0 | 31 | /* Side thicknesses. */ |
paul@0 | 32 | |
paul@0 | 33 | front = 2; |
paul@0 | 34 | back = 3.5; |
paul@0 | 35 | top = 3; |
paul@0 | 36 | left = 2; |
paul@0 | 37 | right = 2; |
paul@0 | 38 | |
paul@0 | 39 | /* Rounding/fillet offset, radius and additional length. |
paul@0 | 40 | The radius needs to be slightly larger than the offset |
paul@0 | 41 | in order to avoid geometry problems. */ |
paul@0 | 42 | |
paul@0 | 43 | ro = 1; |
paul@0 | 44 | rr = 1.01; |
paul@0 | 45 | extra = 0; |
paul@0 | 46 | |
paul@0 | 47 | difference() { |
paul@1 | 48 | |
paul@1 | 49 | /* The cartridge surfaces. */ |
paul@1 | 50 | |
paul@0 | 51 | union() { |
paul@0 | 52 | translate([0, -depth / 2 + front / 2, 0]) |
paul@0 | 53 | cube([width, front, height], center = true); |
paul@0 | 54 | translate([0, depth / 2 - back / 2, 0]) |
paul@0 | 55 | cube([width, back, height], center = true); |
paul@0 | 56 | translate([-width / 2 + left / 2, 0, 0]) |
paul@0 | 57 | cube([left, depth, height], center = true); |
paul@0 | 58 | translate([width / 2 - right / 2, 0, 0]) |
paul@0 | 59 | cube([right, depth, height], center = true); |
paul@0 | 60 | translate([0, 0, height / 2 - top / 2]) |
paul@0 | 61 | cube([width, depth, top], center = true); |
paul@0 | 62 | } |
paul@0 | 63 | |
paul@1 | 64 | /* Label insets. */ |
paul@1 | 65 | |
paul@1 | 66 | union() { |
paul@1 | 67 | |
paul@1 | 68 | /* Front label. */ |
paul@1 | 69 | |
paul@1 | 70 | translate([-front_label_width / 2, -depth / 2, |
paul@1 | 71 | front_label_offset_from_bottom - height / 2]) |
paul@1 | 72 | cube([front_label_width, front_label_depth, |
paul@1 | 73 | front_label_height]); |
paul@1 | 74 | |
paul@1 | 75 | /* Top label. */ |
paul@1 | 76 | |
paul@1 | 77 | translate([-top_label_width / 2, |
paul@1 | 78 | -depth / 2 + top_label_offset_from_front, |
paul@1 | 79 | height / 2 - top_label_depth]) |
paul@1 | 80 | cube([top_label_width, top_label_height, |
paul@1 | 81 | top_label_depth]); |
paul@1 | 82 | } |
paul@1 | 83 | |
paul@2 | 84 | /* Top and side grooves. */ |
paul@2 | 85 | |
paul@2 | 86 | union() { |
paul@2 | 87 | |
paul@2 | 88 | /* Left groove. */ |
paul@2 | 89 | |
paul@2 | 90 | translate([-width / 2 + groove_depth / 2, 0, 0]) |
paul@2 | 91 | cube([groove_depth, groove_depth, height], center = true); |
paul@2 | 92 | |
paul@2 | 93 | /* Right groove. */ |
paul@2 | 94 | |
paul@2 | 95 | translate([width / 2 - groove_depth / 2, 0, 0]) |
paul@2 | 96 | cube([groove_depth, groove_depth, height], center = true); |
paul@2 | 97 | |
paul@2 | 98 | /* Top groove. */ |
paul@2 | 99 | |
paul@2 | 100 | translate([0, 0, height / 2 - groove_depth / 2]) |
paul@2 | 101 | cube([width, groove_depth, groove_depth], center = true); |
paul@2 | 102 | } |
paul@2 | 103 | |
paul@1 | 104 | /* Fillets to round off the edges. */ |
paul@1 | 105 | |
paul@0 | 106 | union() { |
paul@0 | 107 | |
paul@0 | 108 | /* Top left and right rounding. */ |
paul@0 | 109 | |
paul@0 | 110 | translate([-width / 2 + ro, 0, height / 2 - ro]) |
paul@0 | 111 | rotate([0, 0, 180]) |
paul@0 | 112 | rotate([90, 0, 0]) |
paul@0 | 113 | fillet(rr, depth + extra); |
paul@0 | 114 | translate([width / 2 - ro, 0, height / 2 - ro]) |
paul@0 | 115 | rotate([90, 0, 0]) |
paul@0 | 116 | fillet(rr, depth + extra); |
paul@0 | 117 | |
paul@0 | 118 | /* Top back and front rounding. */ |
paul@0 | 119 | |
paul@0 | 120 | translate([0, depth / 2 - ro, height / 2 - ro]) |
paul@0 | 121 | rotate([0, -90, 0]) |
paul@0 | 122 | fillet(rr, width + extra); |
paul@0 | 123 | translate([0, -depth / 2 + ro, height / 2 - ro]) |
paul@0 | 124 | rotate([0, 0, 180]) |
paul@0 | 125 | rotate([0, -90, 0]) |
paul@0 | 126 | fillet(rr, width + extra); |
paul@0 | 127 | |
paul@0 | 128 | /* Edge rounding. */ |
paul@0 | 129 | |
paul@0 | 130 | translate([width / 2 - ro, depth / 2 - ro, 0]) |
paul@0 | 131 | fillet(rr, height + extra); |
paul@0 | 132 | translate([-width / 2 + ro, depth / 2 - ro, 0]) |
paul@0 | 133 | rotate([0, 0, 90]) |
paul@0 | 134 | fillet(rr, height + extra); |
paul@0 | 135 | translate([-width / 2 + ro, -depth / 2 + ro, 0]) |
paul@0 | 136 | rotate([0, 0, 180]) |
paul@0 | 137 | fillet(rr, height + extra); |
paul@0 | 138 | translate([width / 2 - ro, -depth / 2 + ro, 0]) |
paul@0 | 139 | rotate([0, 0, 270]) |
paul@0 | 140 | fillet(rr, height + extra); |
paul@0 | 141 | } |
paul@0 | 142 | } |
paul@0 | 143 | } |
paul@0 | 144 | |
paul@0 | 145 | cartridge(); |
paul@0 | 146 | |