eurobox.scad 3.17 KB
include<vars.scad>
include<modules.scad>

include<cuts.scad>
include<screws.scad>
include<pipes.scad>
use<handles.scad>

module innerWall(x,y,z) {
  difference() {
    volume(x,y,z,strength);
    volume(x,y,z,0);
  }
}

module grateX(x,y,z) {
  translate([0,innergrateXypos-45,z-12]) cube([15,45.1,4.15]);
  hull() {
    translate([0,innergrateXypos,0]) cube([1,2.5,z]);
    translate([18,innergrateXypos-0.65,0]) cube([1,3.8,z]);
  }
}

module grateY(x,y,z) {
  hull() {
    translate([innergrateYxpos,0,0]) cube([2.5,1,z]);
    translate([innergrateYxpos-0.65,18,0]) cube([3.8,1,z]);
  }
}

module grateXY(x,y,z) {
  translate([0,0+strength/2,0]) {
    rotate([0,0,-45]) {
      hull() {
        translate([-2+1.4,8,0]) cube([2.8,1,z]);
        translate([-2+1.4,27.6,0]) cube([2.8,1,z]);
      }
    }
  }
}

module grateZ(x,y,z) {
  hull() {
    translate([-(offset)+gratesize,-(offset)+gratesize,z])
      cube([x-gratesize*2,y-gratesize*2,3.8]);
    translate([-(offset),-(offset),z])
      cube([x,y,2.5]);
      }
}

module grates(x,y,z) {
  translate([ -offset,
              -offset,
              base ]) {
    union() {
      grateX(x,y,z);
      grateY(x,y,z);
      grateXY(x,y,z);
    }
  }
}

module mirroredgrates(x,y,z) {
  union() {
    union() {
      grates(x,y,z);
      translate([-offset*2+x,0, 0]) mirror([1,0,0]) grates(x,y,z);
    }
    translate([0,-offset*2+y, 0]) mirror([0,1,0]) {
      union() {
        grates(x,y,z);
        translate([-offset*2+x,0, 0]) mirror([1,0,0]) grates(x,y,z);
      }
    }
  }
}

module eurobox(x,y,z,handle,handlecaps,pipes,drilled,screws,locked,exploded) {
  if ( handlecaps ) color("#5fe") handles(x,y,z,exploded=exploded ? [0,-5,0]:[0,0,0]);
  if ( screws ) screws(x,y,z, locked=locked, exploded=exploded ? 5:0);
  if ( pipes ) pipes(z, exploded=exploded ? [-5,0,0]:[0,0,0]);

  difference() {
    color("#888") translate([offset, offset, roundborderInner+strength]) {
      difference () {
        union() {
          intersection() {
            union() {
              innerWall(x,y,z);
              mirroredgrates(x,y,z);
              grateZ(x,y,base);
              grateZ(x,y,z-(roundborderInner+strength*2));
              grateZ(x,y,z-(20.6+roundborderInner+strength*3));
              if (handle==true) {
                handleShape(x,y,z,strength,bool=false);
                translate([0,y-30,0])mirror([0,1,0]){
                  handleShape(x,y,z,strength,bool=false);
                }
              }
            }
            intersection() {
              shapeZ(x,y,z);
              translate([-offset,-offset,-(roundborderInner+strength)]) cube([x,y,z]);
            }
          }
        }
        union() {
          volume(x,y,z,0);
          if (handle==true) {
            handleShape(x,y,z,0,bool=true);
            translate([0,y-offset*2,0])mirror([0,1,0]){
              handleShape(x,y,z,0,bool=true);
            }
          }
        }
      }
    }
    if ( drilled ) drills(x,y,z);
  }
}

eurobox(300,400,220,true,drilled=true);

/* testprobes */

/* translate([0,18,0]) #cube([1.9,2,3]); */
/* translate([0,18,18]) #cube([1.5,2,3]); */
/* difference(){ */
/* eurobox(30,40,22,true); */
/*   translate([-1,-1,-10]) cube([15,20,30]); */
/* } */