Source

uniqxstuff / openscad / cube_cage / lazor_parts.scad


// parameters

height = 60; // length of the box in z direction
width = 120; // length of the box in x direction
depht = 80; // length of the box in y direction

material_height = 5;
screw_radius = 1.5;
screw_height = 10;

// position parts

xy_plate(width,depht,material_height);
#xz_plate(width,height,material_height);

// shape definitions

module xz_plate(width,height,material_height){

  difference(){

    union(){
      square([width+2*material_height,height],center=true);
      square([width/2,height+2*material_height],center=true);
    }

    translate([3*width/8,-height/2,0])
      screw_socket(screw_radius,screw_height,material_height);
    translate([-3*width/8,-height/2,0])
      screw_socket(screw_radius,screw_height,material_height);

    rotate([0,0,180]) translate([3*width/8,-height/2,0])
      screw_socket(screw_radius,screw_height,material_height);
    rotate([0,0,180]) translate([-3*width/8,-height/2,0])
      screw_socket(screw_radius,screw_height,material_height);

  }

}

module xy_plate(width,height,materiel_height){

  difference(){
    minkowski(){
      square([width,height],center=true);
      circle(r=material_height);
    }

    translate([width/2+material_height,0,0])
      square([material_height*2,height/2],center=true);
    translate([-width/2-material_height,0,0])
      square([material_height*2,height/2],center=true);

    translate([0,height/2+material_height,0])
      square([width/2,material_height*2],center=true);
    translate([0,-height/2-material_height,0])
      square([width/2,material_height*2],center=true);


    translate([3*width/8,height/2+material_height/2,0])
      circle(r=screw_radius,$fn=25);
    translate([-3*width/8,height/2+material_height/2,0])
      circle(r=screw_radius,$fn=25);

    translate([3*width/8,-height/2-material_height/2,0])
      circle(r=screw_radius,$fn=25);
    translate([-3*width/8,-height/2-material_height/2,0])
      circle(r=screw_radius,$fn=25);

  }

}


module screw_socket(screw_radius,screw_height,material_height){

  union(){
    translate([-screw_radius,0,0])
      square([screw_radius*2,screw_height+screw_radius]);
    translate([-2*screw_radius,screw_height-2*screw_radius,0])
      square([screw_radius*4,screw_radius*2]);
  }

}