1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/cartridge.scad Sat Jan 11 00:25:23 2014 +0100
1.3 @@ -0,0 +1,89 @@
1.4 +module cartridge()
1.5 +{
1.6 + $fn = 50;
1.7 +
1.8 + module fillet(r, h) {
1.9 + translate([0, 0, -h/2])
1.10 + difference() {
1.11 + cube([r, r, h]);
1.12 + cylinder(r = r, h = h);
1.13 + }
1.14 + }
1.15 +
1.16 + /* Cartridge dimensions. */
1.17 +
1.18 + width = 89.0;
1.19 + height = 68.5;
1.20 + depth = 16.5;
1.21 +
1.22 + /* Side thicknesses. */
1.23 +
1.24 + front = 2;
1.25 + back = 3.5;
1.26 + top = 3;
1.27 + left = 2;
1.28 + right = 2;
1.29 +
1.30 + /* Rounding/fillet offset, radius and additional length.
1.31 + The radius needs to be slightly larger than the offset
1.32 + in order to avoid geometry problems. */
1.33 +
1.34 + ro = 1;
1.35 + rr = 1.01;
1.36 + extra = 0;
1.37 +
1.38 + difference() {
1.39 + union() {
1.40 + translate([0, -depth / 2 + front / 2, 0])
1.41 + cube([width, front, height], center = true);
1.42 + translate([0, depth / 2 - back / 2, 0])
1.43 + cube([width, back, height], center = true);
1.44 + translate([-width / 2 + left / 2, 0, 0])
1.45 + cube([left, depth, height], center = true);
1.46 + translate([width / 2 - right / 2, 0, 0])
1.47 + cube([right, depth, height], center = true);
1.48 + translate([0, 0, height / 2 - top / 2])
1.49 + cube([width, depth, top], center = true);
1.50 + }
1.51 +
1.52 + union() {
1.53 +
1.54 + /* Top left and right rounding. */
1.55 +
1.56 + translate([-width / 2 + ro, 0, height / 2 - ro])
1.57 + rotate([0, 0, 180])
1.58 + rotate([90, 0, 0])
1.59 + fillet(rr, depth + extra);
1.60 + translate([width / 2 - ro, 0, height / 2 - ro])
1.61 + rotate([90, 0, 0])
1.62 + fillet(rr, depth + extra);
1.63 +
1.64 + /* Top back and front rounding. */
1.65 +
1.66 + translate([0, depth / 2 - ro, height / 2 - ro])
1.67 + rotate([0, -90, 0])
1.68 + fillet(rr, width + extra);
1.69 + translate([0, -depth / 2 + ro, height / 2 - ro])
1.70 + rotate([0, 0, 180])
1.71 + rotate([0, -90, 0])
1.72 + fillet(rr, width + extra);
1.73 +
1.74 + /* Edge rounding. */
1.75 +
1.76 + translate([width / 2 - ro, depth / 2 - ro, 0])
1.77 + fillet(rr, height + extra);
1.78 + translate([-width / 2 + ro, depth / 2 - ro, 0])
1.79 + rotate([0, 0, 90])
1.80 + fillet(rr, height + extra);
1.81 + translate([-width / 2 + ro, -depth / 2 + ro, 0])
1.82 + rotate([0, 0, 180])
1.83 + fillet(rr, height + extra);
1.84 + translate([width / 2 - ro, -depth / 2 + ro, 0])
1.85 + rotate([0, 0, 270])
1.86 + fillet(rr, height + extra);
1.87 + }
1.88 + }
1.89 +}
1.90 +
1.91 +cartridge();
1.92 +