jbod

jbod.git
git clone git://git.lenczewski.org/jbod.git
Log | Files | Refs | README

faceplate.scad (1812B)


      1 include <constants.scad>
      2 
      3 width = faceplate_width;
      4 units = enclosure_rack_units;
      5 
      6 module logo() {
      7 	// TODO: embossed text?
      8 }
      9 
     10 module faceplate_mesh(porosity = 0.85) {
     11 	// TODO: circle cutouts? shaped cutouts? simple hole with mesh?
     12 }
     13 
     14 module faceplate_mounting_hole(castellated = true) {
     15 	d = 6.8; r = d / 2;
     16 
     17 	if (castellated) {
     18 		w = 14.7; translate([0,-r,0]) %square([w,d]); // template
     19 
     20 		r0 = w - r;
     21 
     22 		union() {
     23 			translate([0,-r,0]) square([w-r, d]);
     24 			translate([r0,0,0]) circle(r);
     25 		}
     26 	} else {
     27 		w = 13.5; translate([0,-r,0]) %square([w,d]); // template
     28 
     29 		o = 13.5 - 10.3;	// initial offset from side
     30 		r0 = r;			// 1st hole centre
     31 		r1 = 10.3 - r;		// 2nd hole centre
     32 
     33 		union() {
     34 			translate([o,0,0]) {
     35 				translate([r0,0,0]) circle(r);
     36 				translate([r0,-r,0]) square([r, d]);
     37 				translate([r1,0,0]) circle(r);
     38 			};
     39 		}
     40 	}
     41 }
     42 
     43 module faceplate(mounting_holes = true, castellated = false, mesh = true, porosity = 0.85) {
     44 	h0 = rack_unit_dims[units][0]; // unit height (including padding)
     45 	h1 = rack_unit_dims[units][1]; // front panel total height
     46 	h2 = rack_unit_dims[units][2]; // distance between mounting hole centres
     47 	h3 = rack_unit_dims[units][3]; // distance of mounting hole from panel bottom
     48 
     49 	linear_extrude(height=faceplate_thickness, center=true) difference() {
     50 		square([width, h1]); // blank front panel
     51 
     52 		if (mounting_holes) {
     53 			translate([0,h3,0])
     54 				faceplate_mounting_hole(castellated=castellated);
     55 			translate([0,h3+h2,0])
     56 				faceplate_mounting_hole(castellated=castellated);
     57 
     58 			translate([width,h3,0]) scale([-1,1,1])
     59 				faceplate_mounting_hole(castellated=castellated);
     60 			translate([width,h3+h2,0]) scale([-1,1,1])
     61 				faceplate_mounting_hole(castellated=castellated);
     62 		}
     63 
     64 		if (mesh) {
     65 			faceplate_mesh(porosity=porosity);
     66 		}
     67 
     68 		logo(); // embossed logo
     69 	};
     70 }