screws.scad 2.95 KB

module screw6x50() {
  color("#ccc") translate([0,0,0]) {
    cylinder(d=0.58,h=5, $fn=10);
    translate([0,0,-screwhead]) {
      cylinder(d=1.2,h=screwhead,$fn=6);
    }
  }
}

module nut() {
  color("#aaa") cylinder(d=1.2,h=nutheight,$fn=6);
}

module shim() {
  color("#eee") cylinder(d=shimdiameter,h=shimheight);
}

module shimSpring(locked) {
  if ( locked == 1 ) {
    color("#0f0") cylinder(d=shimdiameter,h=locked+0.5);
  } else {
    color("#f00") cylinder(d=shimdiameter,h=locked+0.5);
  }
}
module removableshimblock() {
  /* shimblockHeight; */
  /* color("#eee") cylinder(d=1.3,h=0.1); */
}


module cornerscrew( z, upside=false ) {

  translate([0,0,0]) screw6x50();
  shim();

  if ( upside == true ) {
    translate([ 0, 0, shimheight + strength ]) shim();
    /************            GRATE             ************/
    translate([ 0, 0, shimheight + strength + shimheight ]) nut();
    translate([ 0, 0, shimheight + strength + shimheight + 1.26]) nut();
    translate([ 0, 0, shimheight + strength + shimheight + 1.26 + nutheight]) shim();
    /************            NEXT BOX             ************/
    translate([ 0, 0, shimheight + strength + shimheight + 1.26 + nutheight + shimheight+2*strength + 0.1 + shimblockHeight ]) nut();
    translate([ 0, 0, shimheight + strength + shimheight + 1.26 + nutheight + shimheight+2*strength + 0.1 + shimblockHeight + nutheight]) nut();
  } else {
    translate([ 0, 0, shimheight +strength]) nut();
    /************            NEXT BOX             ************/
    translate([ 0, 0, shimheight + strength*2 + 0.1 + shimblockHeight ]) nut();
    /************            GRATE             ************/
    translate([ 0, 0, shimheight + 2.6 + shimblockHeight ]) rotate([0,0,rands(0,90,1)[0]]) nut();
    translate([ 0, 0, shimheight + 2.6 + shimblockHeight + nutheight]) rotate([0,0,rands(0,90,1)[0]])nut();

    /* #translate([ 0, 0, 0.4 + shimheight + strength + locked + 1]) nut(); */
  /* translate([ 0, 0, 0.70 + shimheight + strength +locked + 1]) shim(); */


  /*   translate([ 0, 0, 0.70 + strength+0.2 ]) shim(); */
  
  /*   /\* translate([ 0, 0, 0.4 + shimblockHeight ]) nut(); *\/ */
  /*   /\* translate([ 0, 0, 2.71 + shimblockHeight ]) nut(); *\/ */

  /*   translate([ 0, 0, 0.70 + strength*2 +0.1 +0.2 ]) shim(); */
  /*   translate([ 0, 0, -0.30 + strength*2 + 0.1 + 1.3+locked ]) nut(); */
  /*   /\*   translate([ 0, 0, 2 ]) shim(); *\/ */
  /*   /\*   translate([ 0, 0, 1.7 ]) nut(); *\/ */
  }




}

module cornerscrews(z) {

  translate([2.4
             , 0.8
             , z - 2.66
             ])
  cornerscrew(z,upside=true);

  translate([0.8
             , 2.4
             , recess + strength + shimheight
             ])
    rotate([180,0,0]) {
    cornerscrew(z,upside=false);
  }
}


module screws(x,y,z) {
  cornerscrews(22);
  mirror([0,1,0]) translate([0,-y,0]) cornerscrews(22);
  mirror([1,0,0]) translate([-x,0,0]) cornerscrews(22);
  mirror([1,0,0]) translate([-x,y,0]) mirror([0,1,0]) cornerscrews(22);
}