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@1 | 29 | |
paul@0 | 30 | /* Side thicknesses. */ |
paul@0 | 31 | |
paul@0 | 32 | front = 2; |
paul@0 | 33 | back = 3.5; |
paul@0 | 34 | top = 3; |
paul@0 | 35 | left = 2; |
paul@0 | 36 | right = 2; |
paul@0 | 37 | |
paul@0 | 38 | /* Rounding/fillet offset, radius and additional length. |
paul@0 | 39 | The radius needs to be slightly larger than the offset |
paul@0 | 40 | in order to avoid geometry problems. */ |
paul@0 | 41 | |
paul@0 | 42 | ro = 1; |
paul@0 | 43 | rr = 1.01; |
paul@0 | 44 | extra = 0; |
paul@0 | 45 | |
paul@0 | 46 | difference() { |
paul@1 | 47 | |
paul@1 | 48 | /* The cartridge surfaces. */ |
paul@1 | 49 | |
paul@0 | 50 | union() { |
paul@0 | 51 | translate([0, -depth / 2 + front / 2, 0]) |
paul@0 | 52 | cube([width, front, height], center = true); |
paul@0 | 53 | translate([0, depth / 2 - back / 2, 0]) |
paul@0 | 54 | cube([width, back, height], center = true); |
paul@0 | 55 | translate([-width / 2 + left / 2, 0, 0]) |
paul@0 | 56 | cube([left, depth, height], center = true); |
paul@0 | 57 | translate([width / 2 - right / 2, 0, 0]) |
paul@0 | 58 | cube([right, depth, height], center = true); |
paul@0 | 59 | translate([0, 0, height / 2 - top / 2]) |
paul@0 | 60 | cube([width, depth, top], center = true); |
paul@0 | 61 | } |
paul@0 | 62 | |
paul@1 | 63 | /* Label insets. */ |
paul@1 | 64 | |
paul@1 | 65 | union() { |
paul@1 | 66 | |
paul@1 | 67 | /* Front label. */ |
paul@1 | 68 | |
paul@1 | 69 | translate([-front_label_width / 2, -depth / 2, |
paul@1 | 70 | front_label_offset_from_bottom - height / 2]) |
paul@1 | 71 | cube([front_label_width, front_label_depth, |
paul@1 | 72 | front_label_height]); |
paul@1 | 73 | |
paul@1 | 74 | /* Top label. */ |
paul@1 | 75 | |
paul@1 | 76 | translate([-top_label_width / 2, |
paul@1 | 77 | -depth / 2 + top_label_offset_from_front, |
paul@1 | 78 | height / 2 - top_label_depth]) |
paul@1 | 79 | cube([top_label_width, top_label_height, |
paul@1 | 80 | top_label_depth]); |
paul@1 | 81 | } |
paul@1 | 82 | |
paul@1 | 83 | /* Fillets to round off the edges. */ |
paul@1 | 84 | |
paul@0 | 85 | union() { |
paul@0 | 86 | |
paul@0 | 87 | /* Top left and right rounding. */ |
paul@0 | 88 | |
paul@0 | 89 | translate([-width / 2 + ro, 0, height / 2 - ro]) |
paul@0 | 90 | rotate([0, 0, 180]) |
paul@0 | 91 | rotate([90, 0, 0]) |
paul@0 | 92 | fillet(rr, depth + extra); |
paul@0 | 93 | translate([width / 2 - ro, 0, height / 2 - ro]) |
paul@0 | 94 | rotate([90, 0, 0]) |
paul@0 | 95 | fillet(rr, depth + extra); |
paul@0 | 96 | |
paul@0 | 97 | /* Top back and front rounding. */ |
paul@0 | 98 | |
paul@0 | 99 | translate([0, depth / 2 - ro, height / 2 - ro]) |
paul@0 | 100 | rotate([0, -90, 0]) |
paul@0 | 101 | fillet(rr, width + extra); |
paul@0 | 102 | translate([0, -depth / 2 + ro, height / 2 - ro]) |
paul@0 | 103 | rotate([0, 0, 180]) |
paul@0 | 104 | rotate([0, -90, 0]) |
paul@0 | 105 | fillet(rr, width + extra); |
paul@0 | 106 | |
paul@0 | 107 | /* Edge rounding. */ |
paul@0 | 108 | |
paul@0 | 109 | translate([width / 2 - ro, depth / 2 - ro, 0]) |
paul@0 | 110 | fillet(rr, height + extra); |
paul@0 | 111 | translate([-width / 2 + ro, depth / 2 - ro, 0]) |
paul@0 | 112 | rotate([0, 0, 90]) |
paul@0 | 113 | fillet(rr, height + extra); |
paul@0 | 114 | translate([-width / 2 + ro, -depth / 2 + ro, 0]) |
paul@0 | 115 | rotate([0, 0, 180]) |
paul@0 | 116 | fillet(rr, height + extra); |
paul@0 | 117 | translate([width / 2 - ro, -depth / 2 + ro, 0]) |
paul@0 | 118 | rotate([0, 0, 270]) |
paul@0 | 119 | fillet(rr, height + extra); |
paul@0 | 120 | } |
paul@0 | 121 | } |
paul@0 | 122 | } |
paul@0 | 123 | |
paul@0 | 124 | cartridge(); |
paul@0 | 125 | |