include function midx(a, b) = (a[0] - b[0])/2; function midy(a, b) = (a[1] - b[1])/2; function midz(a, b) = (a[2] - b[2])/2; module cameramount() { e = 0.1; t = .3; h = 17; sfront = [71+t, 31, 1]; sback = [sfront[0]-7*2+5, 24, 1]; slens = [33.4+t, 16.3+t, 20]; th = 2.5; module camera() { // The camera itself. module lens(s=slens) { translate([s[1]/2, s[1]/2, 0]) hull() { cylinder(s[2], d=s[1], d=s[1]); translate([s[0]-s[1], 0, 0]) cylinder(s[2], d=s[1], d=s[1]); } } module body() { r = 10; hull() { translate([0, 0, -t]) rplate(sfront[0], sfront[1], e, r); translate([midx(sfront, sback), midy(sfront, sback), -h-e]) rplate(sback[0], sback[1], e, r); } } translate([0, -sfront[1]/2, 0]) { translate([sfront[0]-slens[0]-7.5+1, midy(sfront, slens), -1]) lens(); body(); } } module plate() { d = sfront[1]+th*2; r = 3; translate([0, -d/2, 0]) { hull() { translate([r, 0, 0]) cube([1, d, th*2]); translate([sfront[0]-d/2+th*3, d/2, 0]) cylinder(th*2, d=d, d=d); } rplate(20, d, 15, r); } } // d = sfront[0]; m = 8; module base() { // Base plate that screws into the body. d = sfront[1]+m*2+th*2; w = 21+m; i = 4; translate([0, -d/2, 0]) difference() { rplate(w, d, th, 3); for (x = [0+i, w-i]) { for (y = [0+i, d-i]) { translate([x, y, -10+th-.3]) mbolt(); } } } } tr = -5; difference() { union() { translate([tr, 0, 0]) plate(); base(); } translate([th+tr, 0, th]) rotate([180, 0, 0]) camera(); } } $fn = 30; cameramount();