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