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 /* Side thicknesses. */ 20 21 front = 2; 22 back = 3.5; 23 top = 3; 24 left = 2; 25 right = 2; 26 27 /* Rounding/fillet offset, radius and additional length. 28 The radius needs to be slightly larger than the offset 29 in order to avoid geometry problems. */ 30 31 ro = 1; 32 rr = 1.01; 33 extra = 0; 34 35 difference() { 36 union() { 37 translate([0, -depth / 2 + front / 2, 0]) 38 cube([width, front, height], center = true); 39 translate([0, depth / 2 - back / 2, 0]) 40 cube([width, back, height], center = true); 41 translate([-width / 2 + left / 2, 0, 0]) 42 cube([left, depth, height], center = true); 43 translate([width / 2 - right / 2, 0, 0]) 44 cube([right, depth, height], center = true); 45 translate([0, 0, height / 2 - top / 2]) 46 cube([width, depth, top], center = true); 47 } 48 49 union() { 50 51 /* Top left and right rounding. */ 52 53 translate([-width / 2 + ro, 0, height / 2 - ro]) 54 rotate([0, 0, 180]) 55 rotate([90, 0, 0]) 56 fillet(rr, depth + extra); 57 translate([width / 2 - ro, 0, height / 2 - ro]) 58 rotate([90, 0, 0]) 59 fillet(rr, depth + extra); 60 61 /* Top back and front rounding. */ 62 63 translate([0, depth / 2 - ro, height / 2 - ro]) 64 rotate([0, -90, 0]) 65 fillet(rr, width + extra); 66 translate([0, -depth / 2 + ro, height / 2 - ro]) 67 rotate([0, 0, 180]) 68 rotate([0, -90, 0]) 69 fillet(rr, width + extra); 70 71 /* Edge rounding. */ 72 73 translate([width / 2 - ro, depth / 2 - ro, 0]) 74 fillet(rr, height + extra); 75 translate([-width / 2 + ro, depth / 2 - ro, 0]) 76 rotate([0, 0, 90]) 77 fillet(rr, height + extra); 78 translate([-width / 2 + ro, -depth / 2 + ro, 0]) 79 rotate([0, 0, 180]) 80 fillet(rr, height + extra); 81 translate([width / 2 - ro, -depth / 2 + ro, 0]) 82 rotate([0, 0, 270]) 83 fillet(rr, height + extra); 84 } 85 } 86 } 87 88 cartridge(); 89