User:Dorkmo/Ideas/Battery/SCAD/Sandbox

From Open Source Ecology
< User:Dorkmo‎ | Ideas‎ | Battery‎ | SCAD
Jump to: navigation, search

mesh

new mesh module idea


height = 80;
tub_width = 65;
tub_length = 70;
outsidewall = 5;
basethickness = 5;
tub_wall = 5;

spacing = 5;
cage_height = 60;
cage_wall = 7.5;
cage_endwall = 2;
cage_base = 5;
wedge_hieght = 10;

mesh_opening = 1 ;
mesh_angle = 45;
mesh_spacing = 2.5;

intersection()
{
translate([0.1,-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))),0])
cube([cage_wall+0.2,(((tub_length-(spacing*2))-(cage_endwall*2))),cage_height], center=false);


//need to translate closer to the cube here with llarge holes

translate([0,0,-mesh_spacing])
{

rotate([0,-mesh_angle,0])

scale([1,1,(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/(((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/sin(90-mesh_angle))*sin(90))])
{
//for - pair of rows to height

  for (h = [1 : floor(((cage_height-cage_base-((((((sin(90)*(cage_wall/sin(90-mesh_angle))))-((sin(mesh_angle)*((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/(sin(90))))))/sin(90))*sin(mesh_angle))))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing)])
   {
    translate(h*[0,0,mesh_spacing])
{

//for - second row

 for (w = [1 : floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing)])
        {
//translate second row
         translate([0,-mesh_spacing/2,mesh_spacing/2])
           {
//make second row copies
            translate(w*[0,mesh_spacing,0])
             {
              rotate([45,0,0])
               {
    cube(size = [(cage_wall*2)+(cage_height/sin(90))*sin(mesh_angle),mesh_opening,mesh_opening], center=false);

               }
             }
           }
         }

//for - create first row
for (w = [0 : floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing)])

             {
              translate(w*[0,mesh_spacing,0])

 {
  rotate([45,0,0])
   { 
//need to tweak
    cube(size = [(cage_wall*2)+(cage_height/sin(90))*sin(mesh_angle),mesh_opening,mesh_opening],center=false);
   }
 }
}
}
}
}
////end cube
}
}
echo((cage_height/sin(90))*sin(mesh_angle));

echo((tub_width-(spacing*3))/2);

 

mesh

tweaking the pattern for holes through the cage

mesh_opening = 1 ;
mesh_angle = 45;
mesh_spacing = 2.5;
cage_wall = 10 ;
width = 20;
height = 20;

cube(size = [20,20,20], center=true);

for (h = [0 : height])
{
translate(h*[0,0,mesh_spacing])
{
rotate([0,mesh_angle,0])
{
for (w = [0 : width])
{
	translate(w*[0,mesh_spacing,0])
{
	rotate([0,0,45])
{
//could put a scale command here to make opening a perfect square
	cube(size = [mesh_opening,mesh_opening,(mesh_opening*2)+(sin(90)*(10/sin(90-mesh_angle)))], center=false);
}
}
}
}
}
} 


cage

cage with side locking divots

updated 20150311

w/ old parameters

height = 90;
tub_width = 36;
tub_length = 70;
basethickness = 5;
tub_wall = 2;
tub_outsidewall = 4;

tubs_rows    = 5;
tubs_columns = 2;

spacing = 1.940055;
center_dividers = 00; //1 yes 0 no
cage_height = 60;
cage_wall = 5.5;
cage_endwall = 2;
cage_base = 5;

mesh_opening = 1.5 ;
mesh_angle = 45;
mesh_spacing = 3.5;

wire_diameter = 2;
wire_holeoffc = 0;
cage_lid_depthinto = 7;
cage_divot_height = 5.5;
tub_lid_depthinto = 7;
tub_divot_height = 5.5;

//begin underlying cage module
module cage()
 {
  union()
   {
    difference()
     {
      cube(size = [(tub_width-(spacing*3))/2,tub_length-(spacing*2),cage_height], center=false);
//cut hole for powder to sit in
       translate([cage_wall, cage_endwall, cage_base])
        cube(size = [((tub_width-(spacing*3))/2)-(cage_wall*2)+0.001,(tub_length-(spacing*2))-(cage_endwall*2),cage_height-cage_base+1], center=false);
     }
   }//end difference begin union
//side locking divots
//1
translate([((tub_width-(spacing*3))/2)/2,0,((tub_width-(spacing*3))/2)/2])
rotate([0,0,90])
divot_sphere_d();
//2
translate([((tub_width-(spacing*3))/2)/2,0,cage_height-(((tub_width-(spacing*3))/2)/2)])
rotate([0,0,90])
divot_sphere_d();
//3
translate([((tub_width-(spacing*3))/2)/2,tub_length-(spacing*2),((tub_width-(spacing*3))/2)/2])
rotate([0,0,270])
divot_sphere_d();
//4
translate([((tub_width-(spacing*3))/2)/2,tub_length-(spacing*2),cage_height-(((tub_width-(spacing*3))/2)/2)])
rotate([0,0,270])
divot_sphere_d();

 }//end union
//end cage
     
//begin mesh hole grid module
module holes()
 {
intersection()
{
translate([0,-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))),0])
cube([cage_wall+0.2,1+((((tub_length-(spacing*2))-(cage_endwall*2)))),cage_height], center=false);


//need to translate closer to the cube here with llarge holes

translate([0,0,-mesh_spacing])
{

rotate([0,-mesh_angle,0])

scale([1,1,(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/(((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/sin(90-mesh_angle))*sin(90))])
{
//for - pair of rows to height

  for (h = [1 : floor(((cage_height-cage_base-((((((sin(90)*(cage_wall/sin(90-mesh_angle))))-((sin(mesh_angle)*((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/(sin(90))))))/sin(90))*sin(mesh_angle))))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing)])
   {
    translate(h*[0,0,mesh_spacing])
{

//for - second row

 for (w = [1 : floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing)])
        {
//translate second row
         translate([0,-mesh_spacing/2,mesh_spacing/2])
           {
//make second row copies
            translate(w*[0,mesh_spacing,0])
             {
              rotate([45,0,0])
               {
    cube(size = [(cage_wall*2)+(cage_height/sin(90))*sin(mesh_angle),mesh_opening,mesh_opening], center=false);

               }
             }
           }
         }

//for - create first row
for (w = [0 : floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing)])

             {
              translate(w*[0,mesh_spacing,0])

 {
  rotate([45,0,0])
   { 
//need to tweak
    cube(size = [(cage_wall*2)+(cage_height/sin(90))*sin(mesh_angle),mesh_opening,mesh_opening],center=false);
   }
 }
}
}
}
}
////end cube
}
}
}
////end mesh hole grid module

//////divot
module divot_sphere()
{
difference()
{
translate([(cage_divot_height/2)/sin(45)*sin(45),0,0])
{
sphere(r = (cage_divot_height/2)/sin(45));
}
translate([(cage_divot_height/2)/sin(45),0,0])
cube(size = [((cage_divot_height/2)/sin(45)*2),((cage_divot_height/2)/sin(45)*2),((cage_divot_height/2)/sin(45)*2)], center=true);
}
}
////end divot module

//begin final cage construction
difference()
 {
  cage();
//begin holes
  translate([(((tub_width-(spacing*3))/2)-cage_wall)+0.0, cage_endwall+((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/2)+(((((tub_length-(spacing*2))-(cage_endwall*2))-(((floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing))*mesh_spacing)+sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))))/2), cage_base])
   {
    holes();
   }
    translate([(cage_wall)-0.0,cage_endwall+((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/2)+(((((tub_length-(spacing*2))-(cage_endwall*2))-(((floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing))*mesh_spacing)+sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))))/2), cage_base])
   {

  mirror([1,0,0])
     {
      #holes();
     }
   }
//end holes

//begin divots

//1
      translate([cage_wall,(((tub_length-(spacing*2))-(cage_endwall*2))*1/4)+cage_endwall,cage_height-(((cage_lid_depthinto-cage_divot_height)/2)+(cage_divot_height/2))])
       {
        #divot_sphere();
       }
//2
      translate([cage_wall,(((tub_length-(spacing*2))-(cage_endwall*2))*3/4)+cage_endwall,cage_height-(((cage_lid_depthinto-cage_divot_height)/2)+(cage_divot_height/2))])
       {
        #divot_sphere();
       }
//3
      translate([cage_wall+(((tub_width-(spacing*3))/2)-(cage_wall*2)),(((tub_length-(spacing*2))-(cage_endwall*2))*1/4)+cage_endwall,cage_height-(((cage_lid_depthinto-cage_divot_height)/2)+(cage_divot_height/2))])
       {
        mirror([1,0,0])
         {
          #divot_sphere();
         }
       }
//4
      translate([cage_wall+(((tub_width-(spacing*3))/2)-(cage_wall*2)),(((tub_length-(spacing*2))-(cage_endwall*2))*3/4)+cage_endwall,cage_height-(((cage_lid_depthinto-cage_divot_height)/2)+(cage_divot_height/2))])
       {
        mirror([1,0,0])
         {
          #divot_sphere();
         }
       }
//end divots
 }
//end cage

//divot by depth module
module divot_sphere_d()
 {
  translate([0,0,0])
   {
    difference()
     {
      translate([(spacing/(1-cos(45)))*sin(45),0,0])
       {
        sphere(r = (spacing/(1-cos(45))));
       }
      translate([(spacing/(1-cos(45))),0,0])
       {
        cube(size = [((spacing/(1-cos(45)))*2),((spacing/(1-cos(45)))*2),((spacing/(1-cos(45)))*2)], center=true);
       }       
     }
   }
 }
//end divot module

//calculate mesh wall minimum thickness
echo(sin(45)*((mesh_spacing-((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))))/sin(90)));


//calculate verticle height of mesh holes to take away from max height of holes
//works okay up to 45 then bugs out. might be because its before the scale down
echo((((((sin(90)*(cage_wall/sin(90-mesh_angle))))-((sin(mesh_angle)*((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/(sin(90))))))/sin(90))*sin(mesh_angle)));



echo("cage cavity y",((tub_width-(spacing*3))/2)-(cage_wall*2));

echo("cage cavity x",(tub_length-(spacing*2))-(cage_endwall*2));

echo("cage cavity z",cage_height-cage_base);

echo("powder volume per cage",((((tub_width-(spacing*3))/2)-(cage_wall*2)))/10*(((tub_length-(spacing*2))-(cage_endwall*2)))/10*(cage_height-cage_base-cage_lid_depthinto)/10,"cm3");

echo("grams nickle hydroxide per cage",(((((tub_width-(spacing*3))/2)-(cage_wall*2)))/10*(((tub_length-(spacing*2))-(cage_endwall*2)))/10*(cage_height-cage_base-cage_lid_depthinto)/10)*(4.10),"grams");//density is 4.10

echo("total grams nickle hydroxide",(((((tub_width-(spacing*3))/2)-(cage_wall*2)))/10*(((tub_length-(spacing*2))-(cage_endwall*2)))/10*(cage_height-cage_base-cage_lid_depthinto)/10)*(4.10)*(tubs_columns*tubs_rows),"grams");

//calculate mesh wall minimum thickness
echo("mesh dividers thickness",sin(45)*((mesh_spacing-((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))))/sin(90)));

 

testprint1 parameteres 20150125

  • smaller mesh holes (mesh min thickness 0.95061)
  • shorter cage height

results

  • mesh holes too small, closed up near center.
  • lower side lock divot malformed
    • infill shrunk inwards on a few lower layers
height = 90;
tub_width = 36;
tub_length = 70;
basethickness = 5;
tub_wall = 2;
tub_outsidewall = 4;

tubs_rows    = 1;
tubs_columns = 1;

spacing = 1.940055;
center_dividers = 00; //1 yes 0 no
cage_height = 40;
cage_wall = 6;
cage_endwall = 2;
cage_base = 5;

mesh_opening = 1.1 ;
mesh_angle = 60;
mesh_spacing = 2.9;

wire_diameter = 2;
wire_holeoffc = 0;
cage_lid_depthinto = 7;
cage_divot_height = 5.5;
tub_lid_depthinto = 7;
tub_divot_height = 5.5;
 

testprint2 parameteres 20150126

changes

  • 45% thicker mesh wall
  • holes sized to midpoint between failed testprint1 and original cage
  • gcode changes
    • slowed down print speed
    • entered more accurate filament diameter 2.8mm on 3mm
height = 90;
tub_width = 46;
tub_length = 70;
basethickness = 5;
tub_wall = 2;
tub_outsidewall = 4;

tubs_rows    = 5;
tubs_columns = 2;

spacing = 1.940055;
center_dividers = 00; //1 yes 0 no
cage_height = 40;
cage_wall = 8;
cage_endwall = 2;
cage_base = 5;

mesh_opening = 1.25 ;
mesh_angle = 52.5;
mesh_spacing = 3.2;

wire_diameter = 2;
wire_holeoffc = 0;
cage_lid_depthinto = 7;
cage_divot_height = 5.5;
tub_lid_depthinto = 7;
tub_divot_height = 5.5;
 

cage with divots

height = 80;
tub_width = 65;
tub_length = 70;
outsidewall = 5;
basethickness = 5;
tub_wall = 5;

spacing = 5;
cage_height = 60;
cage_wall = 7.5;
cage_endwall = 2;
cage_base = 5;
wedge_hieght = 10;

mesh_opening = 1 ;
mesh_angle = 45;
mesh_spacing = 2.5;

wire_diameter = 2;
wire_holeoffc = 0;
lid_depthinto = 7;
divot_height = 5.5;

//begin underlying cage module
module cage()
 {
  difference()
   {
    cube(size = [(tub_width-(spacing*3))/2,tub_length-(spacing*2),cage_height], center=false);
//cut hole for powder to sit in
     translate([cage_wall, cage_endwall, cage_base])
      cube(size = [((tub_width-(spacing*3))/2)-(cage_wall*2),(tub_length-(spacing*2))-(cage_endwall*2),cage_height-cage_base+1], center=false);
   }
 }
//end cage
     
//begin mesh hole grid module
module holes()
 {
intersection()
{
translate([0,-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))),0])
cube([cage_wall+0.2,1+((((tub_length-(spacing*2))-(cage_endwall*2)))),cage_height], center=false);


//need to translate closer to the cube here with llarge holes

translate([0,0,-mesh_spacing])
{

rotate([0,-mesh_angle,0])

scale([1,1,(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/(((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/sin(90-mesh_angle))*sin(90))])
{
//for - pair of rows to height

  for (h = [1 : floor(((cage_height-cage_base-((((((sin(90)*(cage_wall/sin(90-mesh_angle))))-((sin(mesh_angle)*((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/(sin(90))))))/sin(90))*sin(mesh_angle))))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing)])
   {
    translate(h*[0,0,mesh_spacing])
{

//for - second row

 for (w = [1 : floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing)])
        {
//translate second row
         translate([0,-mesh_spacing/2,mesh_spacing/2])
           {
//make second row copies
            translate(w*[0,mesh_spacing,0])
             {
              rotate([45,0,0])
               {
    cube(size = [(cage_wall*2)+(cage_height/sin(90))*sin(mesh_angle),mesh_opening,mesh_opening], center=false);

               }
             }
           }
         }

//for - create first row
for (w = [0 : floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing)])

             {
              translate(w*[0,mesh_spacing,0])

 {
  rotate([45,0,0])
   { 
//need to tweak
    cube(size = [(cage_wall*2)+(cage_height/sin(90))*sin(mesh_angle),mesh_opening,mesh_opening],center=false);
   }
 }
}
}
}
}
////end cube
}
}
}
////end mesh hole grid module

//////divot
module divot_sphere()
{
difference()
{
translate([(divot_height/2)/sin(45)*sin(45),0,0])
{
sphere(r = (divot_height/2)/sin(45));
}
translate([(divot_height/2)/sin(45),0,0])
cube(size = [((divot_height/2)/sin(45)*2),((divot_height/2)/sin(45)*2),((divot_height/2)/sin(45)*2)], center=true);
}
}
////end divot module

//begin final cage construction
difference()
 {
  cage();
//begin holes
  translate([(((tub_width-(spacing*3))/2)-cage_wall)+0.0, cage_endwall+((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/2)+(((((tub_length-(spacing*2))-(cage_endwall*2))-(((floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing))*mesh_spacing)+sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))))/2), cage_base])
   {
    holes();
   }
    translate([(cage_wall)-0.0,cage_endwall+((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/2)+(((((tub_length-(spacing*2))-(cage_endwall*2))-(((floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing))*mesh_spacing)+sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))))/2), cage_base])
   {

  mirror([1,0,0])
     {
      #holes();
     }
   }
//end holes

//begin divots

//1
      translate([cage_wall,(((tub_length-(spacing*2))-(cage_endwall*2))*1/4)+cage_endwall,cage_height-(((lid_depthinto-divot_height)/2)+(divot_height/2))])
       {
        #divot_sphere();
       }
//2
      translate([cage_wall,(((tub_length-(spacing*2))-(cage_endwall*2))*3/4)+cage_endwall,cage_height-(((lid_depthinto-divot_height)/2)+(divot_height/2))])
       {
        #divot_sphere();
       }
//3
      translate([cage_wall+(((tub_width-(spacing*3))/2)-(cage_wall*2)),(((tub_length-(spacing*2))-(cage_endwall*2))*1/4)+cage_endwall,cage_height-(((lid_depthinto-divot_height)/2)+(divot_height/2))])
       {
        mirror([1,0,0])
         {
          #divot_sphere();
         }
       }
//4
      translate([cage_wall+(((tub_width-(spacing*3))/2)-(cage_wall*2)),(((tub_length-(spacing*2))-(cage_endwall*2))*3/4)+cage_endwall,cage_height-(((lid_depthinto-divot_height)/2)+(divot_height/2))])
       {
        mirror([1,0,0])
         {
          #divot_sphere();
         }
       }
//end divots
 }
//end cage


//calculate mesh wall minimum thickness
echo(sin(45)*((mesh_spacing-((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))))/sin(90)));


//calculate verticle height of mesh holes to take away from max height of holes
//works okay up to 45 then bugs out. might be because its before the scale down
echo((((((sin(90)*(cage_wall/sin(90-mesh_angle))))-((sin(mesh_angle)*((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/(sin(90))))))/sin(90))*sin(mesh_angle)));


 


cage without divots

height = 80;
tub_width = 65;
tub_length = 70;
outsidewall = 5;
basethickness = 5;
tub_wall = 5;

spacing = 5;
cage_height = 60;
cage_wall = 7.5;
cage_endwall = 2;
cage_base = 5;
wedge_hieght = 10;

mesh_opening = 1 ;
mesh_angle = 45;
mesh_spacing = 2.5;


//begin underlying cage module
module cage()
 {
  difference()
   {
    cube(size = [(tub_width-(spacing*3))/2,tub_length-(spacing*2),cage_height], center=false);
//cut hole for powder to sit in
     translate([cage_wall, cage_endwall, cage_base])
      cube(size = [((tub_width-(spacing*3))/2)-(cage_wall*2),(tub_length-(spacing*2))-(cage_endwall*2),cage_height-cage_base+1], center=false);
   }
 }
//end cage
     
//begin mesh hole grid module
module holes()
 {
intersection()
{
translate([0,-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))),0])
cube([cage_wall+0.2,1+((((tub_length-(spacing*2))-(cage_endwall*2)))),cage_height], center=false);


//need to translate closer to the cube here with llarge holes

translate([0,0,-mesh_spacing])
{

rotate([0,-mesh_angle,0])

scale([1,1,(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/(((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/sin(90-mesh_angle))*sin(90))])
{
//for - pair of rows to height

  for (h = [1 : floor(((cage_height-cage_base-((((((sin(90)*(cage_wall/sin(90-mesh_angle))))-((sin(mesh_angle)*((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/(sin(90))))))/sin(90))*sin(mesh_angle))))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing)])
   {
    translate(h*[0,0,mesh_spacing])
{

//for - second row

 for (w = [1 : floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing)])
        {
//translate second row
         translate([0,-mesh_spacing/2,mesh_spacing/2])
           {
//make second row copies
            translate(w*[0,mesh_spacing,0])
             {
              rotate([45,0,0])
               {
    cube(size = [(cage_wall*2)+(cage_height/sin(90))*sin(mesh_angle),mesh_opening,mesh_opening], center=false);

               }
             }
           }
         }

//for - create first row
for (w = [0 : floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing)])

             {
              translate(w*[0,mesh_spacing,0])

 {
  rotate([45,0,0])
   { 
//need to tweak
    cube(size = [(cage_wall*2)+(cage_height/sin(90))*sin(mesh_angle),mesh_opening,mesh_opening],center=false);
   }
 }
}
}
}
}
////end cube
}
}
}
////end mesh hole grid module

//begin final cage construction
difference()
 {
  cage();
  translate([(((tub_width-(spacing*3))/2)-cage_wall)+0.0, cage_endwall+((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/2)+(((((tub_length-(spacing*2))-(cage_endwall*2))-(((floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing))*mesh_spacing)+sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))))/2), cage_base])
   {
    holes();
   }
    translate([(cage_wall)-0.0,cage_endwall+((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/2)+(((((tub_length-(spacing*2))-(cage_endwall*2))-(((floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing))*mesh_spacing)+sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))))/2), cage_base])
   {

  mirror([1,0,0])
     {
      #holes();
     }
   }
 }
//end cage


//calculate mesh wall minimum thickness
echo(sin(45)*((mesh_spacing-((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))))/sin(90)));


//calculate verticle height of mesh holes to take away from max height of holes
//works okay up to 45 then bugs out. might be because its before the scale down
echo((((((sin(90)*(cage_wall/sin(90-mesh_angle))))-((sin(mesh_angle)*((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/(sin(90))))))/sin(90))*sin(mesh_angle)));


 


cage with new mesh module

  • mesh module needs adjusted a little. missing a little from side


height = 80;
tub_width = 65;
tub_length = 70;
outsidewall = 5;
basethickness = 5;
tub_wall = 5;

spacing = 5;
cage_height = 60;
cage_wall = 7.5;
cage_endwall = 2;
cage_base = 5;
wedge_hieght = 10;

mesh_opening = 1 ;
mesh_angle = 60;
mesh_spacing = 2;


//begin underlying cage module
module cage()
 {
  difference()
   {
    cube(size = [(tub_width-(spacing*3))/2,tub_length-(spacing*2),cage_height], center=false);
//cut hole for powder to sit in
     translate([cage_wall, cage_endwall, cage_base])
      cube(size = [((tub_width-(spacing*3))/2)-(cage_wall*2),(tub_length-(spacing*2))-(cage_endwall*2),cage_height-cage_base+1], center=false);
   }
 }
//end cage
     
//begin mesh hole grid module
module holes()
 {
intersection()
{
translate([0,-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))),0])
cube([cage_wall+0.2,1+((((tub_length-(spacing*2))-(cage_endwall*2)))),cage_height], center=false);


//need to translate closer to the cube here with llarge holes

translate([0,0,-mesh_spacing])
{

rotate([0,-mesh_angle,0])

scale([1,1,(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/(((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/sin(90-mesh_angle))*sin(90))])
{
//for - pair of rows to height

  for (h = [1 : floor(((cage_height-cage_base-((((((sin(90)*(cage_wall/sin(90-mesh_angle))))-((sin(mesh_angle)*((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/(sin(90))))))/sin(90))*sin(mesh_angle))))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing)])
   {
    translate(h*[0,0,mesh_spacing])
{

//for - second row

 for (w = [1 : floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing)])
        {
//translate second row
         translate([0,-mesh_spacing/2,mesh_spacing/2])
           {
//make second row copies
            translate(w*[0,mesh_spacing,0])
             {
              rotate([45,0,0])
               {
    cube(size = [(cage_wall*2)+(cage_height/sin(90))*sin(mesh_angle),mesh_opening,mesh_opening], center=false);

               }
             }
           }
         }

//for - create first row
for (w = [0 : floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing)])

             {
              translate(w*[0,mesh_spacing,0])

 {
  rotate([45,0,0])
   { 
//need to tweak
    cube(size = [(cage_wall*2)+(cage_height/sin(90))*sin(mesh_angle),mesh_opening,mesh_opening],center=false);
   }
 }
}
}
}
}
////end cube
}
}
}
////end mesh hole grid module

//begin final cage construction
difference()
 {
  cage();
  translate([(((tub_width-(spacing*3))/2)-cage_wall)+0.0, cage_endwall+((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/2)+(((((tub_length-(spacing*2))-(cage_endwall*2))-(((floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing))*mesh_spacing)+sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))))/2), cage_base])
   {
    holes();
   }
    translate([(cage_wall)-0.0,cage_endwall+((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/2)+(((((tub_length-(spacing*2))-(cage_endwall*2))-(((floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing))*mesh_spacing)+sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))))/2), cage_base])
   {

  mirror([1,0,0])
     {
      #holes();
     }
   }
 }
//end cage


//calculate mesh wall minimum thickness
echo(sin(45)*((mesh_spacing-((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))))/sin(90)));


//calculate verticle height of mesh holes to take away from max height of holes
//works okay up to 45 then bugs out. might be because its before the scale down
echo((((((sin(90)*(cage_wall/sin(90-mesh_angle))))-((sin(mesh_angle)*((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/(sin(90))))))/sin(90))*sin(mesh_angle)));













 

cage with old mesh

height = 80;
tub_width = 65;
tub_length = 70;
outsidewall = 5;
basethickness = 5;
tub_wall = 5;

spacing = 5;
cage_height = 60;
cage_wall = 7.5;
cage_endwall = 2;
cage_base = 5;
wedge_hieght = 10;

mesh_opening = 1 ;
mesh_angle = 45;
mesh_spacing = 2.5;


//begin underlying cage module
module cage()
 {
  difference()
   {
    cube(size = [(tub_width-(spacing*3))/2,tub_length-(spacing*2),cage_height], center=false);
//cut hole for powder to sit in
     translate([cage_wall, cage_endwall, cage_base])
      cube(size = [((tub_width-(spacing*3))/2)-(cage_wall*2),(tub_length-(spacing*2))-(cage_endwall*2),cage_height-cage_base+1], center=false);
   }
 }
//end cage
     
//begin mesh hole grid module
module holes()
 {
  for (h = [1 : floor(((cage_height-cage_base-((((((sin(90)*(cage_wall/sin(90-mesh_angle))))-((sin(mesh_angle)*((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/(sin(90))))))/sin(90))*sin(mesh_angle))))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing)])
   {
    translate(h*[0,0,mesh_spacing])
     {
//scale command here to make openings perfect squares
      scale([1,1,(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/(((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/sin(90-mesh_angle))*sin(90))])
       {
        rotate([0,90-mesh_angle,0])
         {
          for (w = [1 : floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing)])
           {
            translate(w*[0,mesh_spacing,0])
             {
              rotate([0,0,45])
               {
                cube(size = [mesh_opening,mesh_opening,(mesh_opening*2)+(sin(90)*(cage_wall/sin(90-mesh_angle)))], center=false);
               }
             }
           }
//begin second row
         for (w = [0 : floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing)])
           {
            translate([mesh_spacing/2,mesh_spacing/2,-mesh_spacing/2])
             {
              translate(w*[0,mesh_spacing,0])
               {
                rotate([0,0,45])
                 {
                  cube(size = [mesh_opening,mesh_opening,(mesh_opening*2)+(sin(90)*(cage_wall/sin(90-mesh_angle)))], center=false);           
                 }
               }
             }
           }
         }
       }
     }
   }
 }
//end mesh hole grid module

//begin final cage construction
difference()
 {
  cage();
  translate([((tub_width-(spacing*3))/2)-cage_wall-((sin(mesh_angle)*sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/2), cage_endwall-(mesh_spacing/2)+(((((tub_length-(spacing*2))-(cage_endwall*2))-(((floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing))*mesh_spacing)+sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))))/2), cage_base])
   {
    holes();
   }
    translate([cage_wall+((sin(mesh_angle)*sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/2), cage_endwall-(mesh_spacing/2)+(((((tub_length-(spacing*2))-(cage_endwall*2))-(((floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing))*mesh_spacing)+sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))))/2), cage_base])
   {

  mirror([1,0,0])
     {
      #holes();
     }
   }
 }
//end cage


//calculate mesh wall minimum thickness
echo(sin(45)*((mesh_spacing-((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))))/sin(90)));


//calculate verticle height of mesh holes to take away from max height of holes
//works okay up to 45 then bugs out. might be because its before the scale down
echo((((((sin(90)*(cage_wall/sin(90-mesh_angle))))-((sin(mesh_angle)*((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/(sin(90))))))/sin(90))*sin(mesh_angle)));


 

inside cage


height = 60;
tub_width = 95;
tub_length = 70;
outsidewall = 5;
basethickness = 5;
tub_wall = 5;

spacing = 5;
cage_height = 40;
cage_wall = 10;
cage_endwall = 5;
cage_base = 5;
wedge_hieght = 10;

mesh_opening = 2 ;
mesh_angle = 45;
mesh_spacing = 4;
mesh_width = 17;
mesh_height = 10;

difference()
	{
		cube(size = [(tub_width-(spacing*3))/2,tub_length-(spacing*2),cage_height], center=false);
		translate([cage_wall, cage_endwall, cage_base])
			cube(size = [((tub_width-(spacing*3))/2)-(cage_wall*2),(tub_length-(spacing*2))-(cage_endwall*2),cage_height-cage_base+1], center=false);
  translate([((tub_width-(spacing*3))/2)-cage_wall-((sin(mesh_angle)*sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/2), cage_endwall-(mesh_spacing/2)+(((((tub_length-(spacing*2))-(cage_endwall*2))-(((floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing))*mesh_spacing)+sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))))/2), cage_base])
   {
    for (h = [1 : mesh_height])
     {
      translate(h*[0,0,mesh_spacing])
       {
        scale([1,1,(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/(((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/sin(90-mesh_angle))*sin(90))])
         {
        rotate([0,90-mesh_angle,0])
         {
          for (w = [1 : floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing)])
           {
            translate(w*[0,mesh_spacing,0])
             {
              rotate([0,0,45])
               {
//could put a scale command here to make opening a perfect square
                cube(size = [mesh_opening,mesh_opening,(mesh_opening*2)+(sin(90)*(10/sin(90-mesh_angle)))], center=false);
               }
             }
           }
//begin second row
         #for (w = [0 : floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing)])
           {
            translate([mesh_spacing/2,mesh_spacing/2,-mesh_spacing/2])
             {
              translate(w*[0,mesh_spacing,0])
               {
                rotate([0,0,45])
                 {
//could put a scale command here to make opening a perfect square
                cube(size = [mesh_opening,mesh_opening,(mesh_opening*2)+(sin(90)*(10/sin(90-mesh_angle)))], center=false);
                 }
               }
             }
           }
//end second row
         }
         }
       }
     }
   }
 }


echo(((floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing))*mesh_spacing)+sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)));

echo((tub_length-(spacing*2))-(cage_endwall*2));

echo((((((tub_length-(spacing*2))-(cage_endwall*2))-(((floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing))*mesh_spacing)+sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))))/2));

 

cage lid

cuts in lip

updated 20150301

height = 90;
tub_width = 46;
tub_length = 70;
basethickness = 5;
tub_wall = 2;
tub_outsidewall = 4;

tubs_rows    = 5;
tubs_columns = 2;

spacing = 1.940055;
center_dividers = 00; //1 yes 0 no
cage_height = 60;
cage_wall = 8;
cage_endwall = 2;
cage_base = 5;

mesh_opening = 1.5 ;
mesh_angle = 52.5;
mesh_spacing = 3.5;

wire_count = 7; //number of wires into each cage
wire_diameter = 2;
wire_holeoffc = 0;
cage_lid_cut = 0; //1 yes 0 no cavity in lid or not?
cage_minicleat = 2;
yn_cage_minicleat = 1; //1 yes 0 no
yn_cage_cleat = 0; //1 yes 0 no
cage_lid_depthinto = 7;
cage_divot_height = 5.5;
tub_lid_depthinto = 7;
tub_divot_height = 5.5;

shrink_cage_lid = 0.5;
base_chamfer_depth = 0.9; //max 1.0
base_wire_cone = 0.2; //diameter added to wire_diameter

union()
 {
  difference()
   {
    union()
     {
      translate([shrink_cage_lid/2,shrink_cage_lid/2,0])
       {
      cube(size = [(((tub_width-(spacing*3))/2)-(cage_wall*2))-shrink_cage_lid,((tub_length-(spacing*2))-(cage_endwall*2))-shrink_cage_lid,cage_lid_depthinto], center=false);
       }
      translate([-1,-1,cage_lid_depthinto])
       {
        cube(size = [(((tub_width-(spacing*3))/2)-(cage_wall*2))+2,((tub_length-(spacing*2))-(cage_endwall*2))+2,2], center=false);
       }
//spheres lock ins
//1
      translate([(shrink_cage_lid/2),((tub_length-(spacing*2))-(cage_endwall*2))*1/4,((cage_lid_depthinto-cage_divot_height)/2)+(cage_divot_height/2)])
       {
        divot_sphere();
       }
//2
      translate([(shrink_cage_lid/2),((tub_length-(spacing*2))-(cage_endwall*2))*3/4,((cage_lid_depthinto-cage_divot_height)/2)+(cage_divot_height/2)])
       {
        divot_sphere();
       }
//3
      translate([(((tub_width-(spacing*3))/2)-(cage_wall*2))-(shrink_cage_lid/2),((tub_length-(spacing*2))-(cage_endwall*2))*1/4,((cage_lid_depthinto-cage_divot_height)/2)+(cage_divot_height/2)])
       {
        mirror([1,0,0])
         {
          divot_sphere();
         }
       }
//4
      translate([(((tub_width-(spacing*3))/2)-(cage_wall*2))-(shrink_cage_lid/2),((tub_length-(spacing*2))-(cage_endwall*2))*3/4,((cage_lid_depthinto-cage_divot_height)/2)+(cage_divot_height/2)])
       {
        mirror([1,0,0])
         {
          divot_sphere();
         }
       }
//end spheres

//minicleats
//1
translate([((((((tub_width-(spacing*3))/2)-(cage_wall*2))+2)/2)-cage_minicleat)+((((tub_width-(spacing*3))/2)-(cage_wall*2)))/2,((((tub_length-(spacing*2))-(cage_endwall*2))*1/2))+(2),cage_lid_depthinto+2])
   {

for(w = [-(wire_count-1)/2 : (wire_count-1)/2])
 {
  translate(w*[0,((((tub_length-(spacing*2))-(cage_endwall*2)-2))/(wire_count+1)),0])
   {
if (yn_cage_minicleat==1) mini_cleat(cage_minicleat,1);
}
}
}

//2
translate([-((((((tub_width-(spacing*3))/2)-(cage_wall*2))+2)/2)-cage_minicleat)+((((tub_width-(spacing*3))/2)-(cage_wall*2)))/2,((((tub_length-(spacing*2))-(cage_endwall*2))*1/2))+(2),cage_lid_depthinto+2])
   {
mirror([1,0,0])
{
for(w = [-(wire_count-1)/2 : (wire_count-1)/2])
 {
  translate(w*[0,((((tub_length-(spacing*2))-(cage_endwall*2)-2))/(wire_count+1)),0])
   {
if (yn_cage_minicleat==1) mini_cleat(cage_minicleat,1);
}
}
}
}

//end mini cleats


     }
//end union begin difference
  translate([1,1,1])
   {
    if (cage_lid_cut==1) cube(size = [((tub_width-(spacing*3))/2)-(cage_wall*2)-2,(tub_length-(spacing*2))-(cage_endwall*2)-2,cage_lid_depthinto+3], center=false);
   }
//chamfer underside of lip
  translate([-2,-1,cage_lid_depthinto-1])
   {
    rotate([45,0,0])
     {
      cube(size = [(((tub_width-(spacing*3))/2)-(cage_wall*2))+4,sqrt(2),sqrt(2)], center=false);
     }
   }
  translate([-2,(tub_length-(spacing*2))-(cage_endwall*2)+1,cage_lid_depthinto-1])
   {
    rotate([45,0,0])
     {
      cube(size = [(((tub_width-(spacing*3))/2)-(cage_wall*2))+4,sqrt(2),sqrt(2)], center=false);
     }
   }
  translate([-1,-2,cage_lid_depthinto-1])
   {
    rotate([45,0,90])
     {
      cube(size = [((tub_length-(spacing*2))-(cage_endwall*2))+4,sqrt(2),sqrt(2)], center=false);
     }
   }
  translate([(((tub_width-(spacing*3))/2)-(cage_wall*2))+1,-2,cage_lid_depthinto-1])
   {
    rotate([45,0,90])
     {
      cube(size = [((tub_length-(spacing*2))-(cage_endwall*2))+4,sqrt(2),sqrt(2)], center=false);
     }
   }
//end chamfer


//chamfer base
  translate([-2,base_chamfer_depth-1,-1])
   {
    rotate([45,0,0])
     {
      #cube(size = [(((tub_width-(spacing*3))/2)-(cage_wall*2))+4,sqrt(2),sqrt(2)], center=false);
     }
   }
  translate([-2,(tub_length-(spacing*2))-(cage_endwall*2)+1-base_chamfer_depth,-1])
   {
    rotate([45,0,0])
     {
      #cube(size = [(((tub_width-(spacing*3))/2)-(cage_wall*2))+4,sqrt(2),sqrt(2)], center=false);
     }
   }
  translate([-1+base_chamfer_depth,-2,-1])
   {
    rotate([45,0,90])
     {
      #cube(size = [((tub_length-(spacing*2))-(cage_endwall*2))+4,sqrt(2),sqrt(2)], center=false);
     }
   }
  translate([(((tub_width-(spacing*3))/2)-(cage_wall*2))+1-base_chamfer_depth,-2,-1])
   {
    rotate([45,0,90])
     {
      #cube(size = [((tub_length-(spacing*2))-(cage_endwall*2))+4,sqrt(2),sqrt(2)], center=false);
     }
   }
//end chamfer

//begin wire holes
  translate([-1,(((tub_length-(spacing*2))-(cage_endwall*2))*1/2),cage_lid_depthinto])
   {

for(w = [-(wire_count-1)/2 : (wire_count-1)/2])
 {
  translate(w*[0,((((tub_length-(spacing*2))-(cage_endwall*2)-2))/(wire_count+1)),0])
   {
    rotate([0,0,45])
     {
      #cube(size=[sqrt(2),sqrt(2),3]);
     }
   }
 } 


   }
//end wire holes


//end difference
 }
//begin union

//cleat
    translate([((((tub_width-(spacing*3))/2)-(cage_wall*2)))/2,(((tub_length-(spacing*2))-(cage_endwall*2))*1/2)-(wire_diameter*1.5)-1+wire_holeoffc,0])
     {
        if (yn_cage_cleat==1) cleat(2,cage_lid_depthinto+2);
     }
    translate([((((tub_width-(spacing*3))/2)-(cage_wall*2)))/2,(((tub_length-(spacing*2))-(cage_endwall*2))*1/2)+(wire_diameter*1.5)+1+wire_holeoffc,0])
     {
      mirror([0,1,0])
       {
        if (yn_cage_cleat==1) cleat(2,cage_lid_depthinto+2);
       }
     }
//end cleat
}


//divot
module divot_sphere()
{
difference()
{
translate([(cage_divot_height/2)/sin(45)*sin(45),0,0])
{
sphere(r = (cage_divot_height/2)/sin(45));
}
translate([(cage_divot_height/2)/sin(45),0,0])
cube(size = [((cage_divot_height/2)/sin(45)*2),((cage_divot_height/2)/sin(45)*2),((cage_divot_height/2)/sin(45)*2)], center=true);
}
}

////cleat module
module cleat(size,height)
 {
  translate([0,0,-size])
  {
  difference()
   {
    rotate([45,0,0])
     {
      rotate([0,0,45])
       {
        cube(size = [size,size,height/sin(45)], center=false);
       }
     }
    translate([-size*3/2,-size*3/2,0])
     {
      #cube(size = [size*3,size*3,size],center=false);
     }
   }
 }
}
//end cleat

//mini_cleat module
module mini_cleat(sides,height)
{
union()
{
#cube(size = [sides,sides,height]);
translate([0,0,height])
{
polyhedron
  (points = [ [0,0,0],[sides,0,0],[sides,sides,0],[0,sides,0],
           [sides,0,sides],[sides*2,0,sides],[sides*2,sides,sides],[sides,sides,sides]
         ],
  faces = [ [0,1,2],[0,2,3], //
          [0,5,1],[0,4,5],   //
          [1,5,6],[1,6,2],   
          [2,6,7],[2,7,3],
          [3,7,4],[3,4,0],
          [4,7,6],[4,6,5]
        ]
);
}
}
}
//end mini cleat module
 

no cavity with multiple cleats

height = 90;
tub_width = 36;
tub_length = 70;
basethickness = 5;
tub_wall = 2;
tub_outsidewall = 4;

tubs_rows    = 5;
tubs_columns = 2;

spacing = 1.940055;
center_dividers = 00; //1 yes 0 no
cage_height = 60;
cage_wall = 5.5;
cage_endwall = 2;
cage_base = 5;

mesh_opening = 1.5 ;
mesh_angle = 45;
mesh_spacing = 3.5;

wire_count = 7; //number of wires into each cage
wire_diameter = 0.8;
wire_holeoffc = 0;
cage_lid_cut = 0; //1 yes 0 no cavity in lid or not?
cage_minicleat = 2;
yn_cage_minicleat = 1; //1 yes 0 no
yn_cage_cleat = 0; //1 yes 0 no
cage_lid_depthinto = 7;
cage_divot_height = 5.5;
tub_lid_depthinto = 7;
tub_divot_height = 5.5;

union()
 {
  difference()
   {
    union()
     {
      cube(size = [((tub_width-(spacing*3))/2)-(cage_wall*2),(tub_length-(spacing*2))-(cage_endwall*2),cage_lid_depthinto], center=false);
      translate([-1,-1,cage_lid_depthinto])
       {
        cube(size = [(((tub_width-(spacing*3))/2)-(cage_wall*2))+2,((tub_length-(spacing*2))-(cage_endwall*2))+2,2], center=false);
       }
//spheres lock ins
//1
      translate([0,((tub_length-(spacing*2))-(cage_endwall*2))*1/4,((cage_lid_depthinto-cage_divot_height)/2)+(cage_divot_height/2)])
       {
        divot_sphere();
       }
//2
      translate([0,((tub_length-(spacing*2))-(cage_endwall*2))*3/4,((cage_lid_depthinto-cage_divot_height)/2)+(cage_divot_height/2)])
       {
        divot_sphere();
       }
//3
      translate([((tub_width-(spacing*3))/2)-(cage_wall*2),((tub_length-(spacing*2))-(cage_endwall*2))*1/4,((cage_lid_depthinto-cage_divot_height)/2)+(cage_divot_height/2)])
       {
        mirror([1,0,0])
         {
          divot_sphere();
         }
       }
//4
      translate([((tub_width-(spacing*3))/2)-(cage_wall*2),((tub_length-(spacing*2))-(cage_endwall*2))*3/4,((cage_lid_depthinto-cage_divot_height)/2)+(cage_divot_height/2)])
       {
        mirror([1,0,0])
         {
          divot_sphere();
         }
       }
//end spheres

//minicleats
//1
translate([((((((tub_width-(spacing*3))/2)-(cage_wall*2))+2)/2)-cage_minicleat)+((((tub_width-(spacing*3))/2)-(cage_wall*2)))/2,((((tub_length-(spacing*2))-(cage_endwall*2))*1/2))+(wire_diameter/2),cage_lid_depthinto+2])
   {

for(w = [-(wire_count-1)/2 : (wire_count-1)/2])
 {
  translate(w*[0,((((tub_length-(spacing*2))-(cage_endwall*2)-2))/(wire_count+1)),0])
   {
if (yn_cage_minicleat==1) mini_cleat(cage_minicleat,1);
}
}
}

//2
translate([-((((((tub_width-(spacing*3))/2)-(cage_wall*2))+2)/2)-cage_minicleat)+((((tub_width-(spacing*3))/2)-(cage_wall*2)))/2,((((tub_length-(spacing*2))-(cage_endwall*2))*1/2))+(wire_diameter/2),cage_lid_depthinto+2])
   {
mirror([1,0,0])
{
for(w = [-(wire_count-1)/2 : (wire_count-1)/2])
 {
  translate(w*[0,((((tub_length-(spacing*2))-(cage_endwall*2)-2))/(wire_count+1)),0])
   {
if (yn_cage_minicleat==1) mini_cleat(cage_minicleat,1);
}
}
}
}

//end mini cleats


     }
//end union begin difference
  translate([1,1,1])
   {
    if (cage_lid_cut==1) cube(size = [((tub_width-(spacing*3))/2)-(cage_wall*2)-2,(tub_length-(spacing*2))-(cage_endwall*2)-2,cage_lid_depthinto+3], center=false);
   }
//chamfer underside of lip
  translate([-2,-1,cage_lid_depthinto-1])
   {
    rotate([45,0,0])
     {
      cube(size = [(((tub_width-(spacing*3))/2)-(cage_wall*2))+4,sqrt(2),sqrt(2)], center=false);
     }
   }
  translate([-2,(tub_length-(spacing*2))-(cage_endwall*2)+1,cage_lid_depthinto-1])
   {
    rotate([45,0,0])
     {
      cube(size = [(((tub_width-(spacing*3))/2)-(cage_wall*2))+4,sqrt(2),sqrt(2)], center=false);
     }
   }
  translate([-1,-2,cage_lid_depthinto-1])
   {
    rotate([45,0,90])
     {
      cube(size = [((tub_length-(spacing*2))-(cage_endwall*2))+4,sqrt(2),sqrt(2)], center=false);
     }
   }
  translate([(((tub_width-(spacing*3))/2)-(cage_wall*2))+1,-2,cage_lid_depthinto-1])
   {
    rotate([45,0,90])
     {
      cube(size = [((tub_length-(spacing*2))-(cage_endwall*2))+4,sqrt(2),sqrt(2)], center=false);
     }
   }
//end chamfer


//begin wire holes
  translate([((((tub_width-(spacing*3))/2)-(cage_wall*2)))/2,(((tub_length-(spacing*2))-(cage_endwall*2))*1/2),-1])
   {

for(w = [-(wire_count-1)/2 : (wire_count-1)/2])
 {
  translate(w*[0,((((tub_length-(spacing*2))-(cage_endwall*2)-2))/(wire_count+1)),0])
   {
    #cylinder(r = wire_diameter/2, h = cage_lid_depthinto+2+2);
   }
 } 


   }
//end wire holes


//end difference
 }
//begin union

//cleat
    translate([((((tub_width-(spacing*3))/2)-(cage_wall*2)))/2,(((tub_length-(spacing*2))-(cage_endwall*2))*1/2)-(wire_diameter*1.5)-1+wire_holeoffc,0])
     {
        if (yn_cage_cleat==1) cleat(2,cage_lid_depthinto+2);
     }
    translate([((((tub_width-(spacing*3))/2)-(cage_wall*2)))/2,(((tub_length-(spacing*2))-(cage_endwall*2))*1/2)+(wire_diameter*1.5)+1+wire_holeoffc,0])
     {
      mirror([0,1,0])
       {
        if (yn_cage_cleat==1) cleat(2,cage_lid_depthinto+2);
       }
     }
//end cleat
}


//divot
module divot_sphere()
{
difference()
{
translate([(cage_divot_height/2)/sin(45)*sin(45),0,0])
{
sphere(r = (cage_divot_height/2)/sin(45));
}
translate([(cage_divot_height/2)/sin(45),0,0])
cube(size = [((cage_divot_height/2)/sin(45)*2),((cage_divot_height/2)/sin(45)*2),((cage_divot_height/2)/sin(45)*2)], center=true);
}
}

////cleat module
module cleat(size,height)
 {
  translate([0,0,-size])
  {
  difference()
   {
    rotate([45,0,0])
     {
      rotate([0,0,45])
       {
        cube(size = [size,size,height/sin(45)], center=false);
       }
     }
    translate([-size*3/2,-size*3/2,0])
     {
      #cube(size = [size*3,size*3,size],center=false);
     }
   }
 }
}
//end cleat

//mini_cleat module
module mini_cleat(sides,height)
{
union()
{
#cube(size = [sides,sides,height]);
translate([0,0,height])
{
polyhedron
  (points = [ [0,0,0],[sides,0,0],[sides,sides,0],[0,sides,0],
           [sides,0,sides],[sides*2,0,sides],[sides*2,sides,sides],[sides,sides,sides]
         ],
  faces = [ [0,1,2],[0,2,3], //
          [0,5,1],[0,4,5],   //
          [1,5,6],[1,6,2],   
          [2,6,7],[2,7,3],
          [3,7,4],[3,4,0],
          [4,7,6],[4,6,5]
        ]
);
}
}
}
//end mini cleat module
 

small lip with divots and cleat

height = 80;
tub_width = 65;
tub_length = 70;
outsidewall = 5;
basethickness = 5;
tub_wall = 5;

spacing = 5;
cage_height = 60;
cage_wall = 7.5;
cage_endwall = 2;
cage_base = 5;
wedge_hieght = 10;

mesh_opening = 1 ;
mesh_angle = 45;
mesh_spacing = 2.5;

wire_diameter = 2;
wire_holeoffc = 0;
lid_depthinto = 7;
divot_height = 5.5;

union()
 {
  difference()
   {
    union()
     {
      cube(size = [((tub_width-(spacing*3))/2)-(cage_wall*2),(tub_length-(spacing*2))-(cage_endwall*2),lid_depthinto], center=false);
      translate([-1,-1,lid_depthinto])
       {
        cube(size = [(((tub_width-(spacing*3))/2)-(cage_wall*2))+2,((tub_length-(spacing*2))-(cage_endwall*2))+2,2], center=false);
       }
//spheres lock ins
//1
      translate([0,((tub_length-(spacing*2))-(cage_endwall*2))*1/4,((lid_depthinto-divot_height)/2)+(divot_height/2)])
       {
        divot_sphere();
       }
//2
      translate([0,((tub_length-(spacing*2))-(cage_endwall*2))*3/4,((lid_depthinto-divot_height)/2)+(divot_height/2)])
       {
        divot_sphere();
       }
//3
      translate([((tub_width-(spacing*3))/2)-(cage_wall*2),((tub_length-(spacing*2))-(cage_endwall*2))*1/4,((lid_depthinto-divot_height)/2)+(divot_height/2)])
       {
        mirror([1,0,0])
         {
          divot_sphere();
         }
       }
//4
      translate([((tub_width-(spacing*3))/2)-(cage_wall*2),((tub_length-(spacing*2))-(cage_endwall*2))*3/4,((lid_depthinto-divot_height)/2)+(divot_height/2)])
       {
        mirror([1,0,0])
         {
          divot_sphere();
         }
       }
//end spheres



     }
//end union begin difference
  translate([1,1,1])
   {
    cube(size = [((tub_width-(spacing*3))/2)-(cage_wall*2)-2,(tub_length-(spacing*2))-(cage_endwall*2)-2,lid_depthinto+3], center=false);
   }
//chamfer underside of lip
  translate([-2,-1,lid_depthinto-1])
   {
    rotate([45,0,0])
     {
      cube(size = [(((tub_width-(spacing*3))/2)-(cage_wall*2))+4,sqrt(2),sqrt(2)], center=false);
     }
   }
  translate([-2,(tub_length-(spacing*2))-(cage_endwall*2)+1,lid_depthinto-1])
   {
    rotate([45,0,0])
     {
      cube(size = [(((tub_width-(spacing*3))/2)-(cage_wall*2))+4,sqrt(2),sqrt(2)], center=false);
     }
   }
  translate([-1,-2,lid_depthinto-1])
   {
    rotate([45,0,90])
     {
      cube(size = [((tub_length-(spacing*2))-(cage_endwall*2))+4,sqrt(2),sqrt(2)], center=false);
     }
   }
  translate([(((tub_width-(spacing*3))/2)-(cage_wall*2))+1,-2,lid_depthinto-1])
   {
    rotate([45,0,90])
     {
      cube(size = [((tub_length-(spacing*2))-(cage_endwall*2))+4,sqrt(2),sqrt(2)], center=false);
     }
   }
//end chamfer
//begin wire hole
  translate([((((tub_width-(spacing*3))/2)-(cage_wall*2)))/2,(((tub_length-(spacing*2))-(cage_endwall*2))*1/2),-1])
   {
    cylinder(r = wire_diameter/2, h = 3);
   }
//end wire hole
//end difference
 }
//begin union

//cleat
    translate([((((tub_width-(spacing*3))/2)-(cage_wall*2)))/2,(((tub_length-(spacing*2))-(cage_endwall*2))*1/2)-(wire_diameter*1.5)-1+wire_holeoffc,0])
     {
      cleat(2,lid_depthinto+2);
     }
    translate([((((tub_width-(spacing*3))/2)-(cage_wall*2)))/2,(((tub_length-(spacing*2))-(cage_endwall*2))*1/2)+(wire_diameter*1.5)+1+wire_holeoffc,0])
     {
      mirror([0,1,0])
       {
        cleat(2,lid_depthinto+2);
       }
     }
//end cleat
}


//divot
module divot_sphere()
{
difference()
{
translate([(divot_height/2)/sin(45)*sin(45),0,0])
{
sphere(r = (divot_height/2)/sin(45));
}
translate([(divot_height/2)/sin(45),0,0])
cube(size = [((divot_height/2)/sin(45)*2),((divot_height/2)/sin(45)*2),((divot_height/2)/sin(45)*2)], center=true);
}
}

////cleat module
module cleat(size,height)
 {
  translate([0,0,-size])
  {
  difference()
   {
    rotate([45,0,0])
     {
      rotate([0,0,45])
       {
        cube(size = [size,size,height/sin(45)], center=false);
       }
     }
    translate([-size*3/2,-size*3/2,0])
     {
      #cube(size = [size*3,size*3,size],center=false);
     }
   }
 }
}

 


chamfered small lip

height = 80;
tub_width = 65;
tub_length = 70;
outsidewall = 5;
basethickness = 5;
tub_wall = 5;

spacing = 5;
cage_height = 60;
cage_wall = 7.5;
cage_endwall = 2;
cage_base = 5;
wedge_hieght = 10;

mesh_opening = 1 ;
mesh_angle = 45;
mesh_spacing = 2.5;

wire_diameter = 2;
lid_depthinto = 4;

difference()
{
union()
{
cube(size = [((tub_width-(spacing*3))/2)-(cage_wall*2),(tub_length-(spacing*2))-(cage_endwall*2),lid_depthinto], center=false);

translate([-1,-1,lid_depthinto])
{
cube(size = [(((tub_width-(spacing*3))/2)-(cage_wall*2))+2,((tub_length-(spacing*2))-(cage_endwall*2))+2,2], center=false);
}
//spheres lock ins


//end spheres
}
//end union begin difference
translate([1,1,1])
{
cube(size = [((tub_width-(spacing*3))/2)-(cage_wall*2)-2,(tub_length-(spacing*2))-(cage_endwall*2)-2,lid_depthinto+3], center=false);
}
//chamfer underside of lip
translate([-2,-1,lid_depthinto-1])
{
rotate([45,0,0])
{
cube(size = [(((tub_width-(spacing*3))/2)-(cage_wall*2))+4,sqrt(2),sqrt(2)], center=false);
}
}
translate([-2,(tub_length-(spacing*2))-(cage_endwall*2)+1,lid_depthinto-1])
{
rotate([45,0,0])
{
cube(size = [(((tub_width-(spacing*3))/2)-(cage_wall*2))+4,sqrt(2),sqrt(2)], center=false);
}
}
translate([-1,-2,lid_depthinto-1])
{
rotate([45,0,90])
{
cube(size = [((tub_length-(spacing*2))-(cage_endwall*2))+4,sqrt(2),sqrt(2)], center=false);
}
}
translate([(((tub_width-(spacing*3))/2)-(cage_wall*2))+1,-2,lid_depthinto-1])
{
rotate([45,0,90])
{
cube(size = [((tub_length-(spacing*2))-(cage_endwall*2))+4,sqrt(2),sqrt(2)], center=false);
}
}
}
 


chamfered small lip with divots


height = 80;
tub_width = 65;
tub_length = 70;
outsidewall = 5;
basethickness = 5;
tub_wall = 5;

spacing = 5;
cage_height = 60;
cage_wall = 7.5;
cage_endwall = 2;
cage_base = 5;
wedge_hieght = 10;

mesh_opening = 1 ;
mesh_angle = 45;
mesh_spacing = 2.5;

wire_diameter = 2;
lid_depthinto = 7;
divot_height = 5.5;

difference()
{
union()
{
cube(size = [((tub_width-(spacing*3))/2)-(cage_wall*2),(tub_length-(spacing*2))-(cage_endwall*2),lid_depthinto], center=false);

translate([-1,-1,lid_depthinto])
{
cube(size = [(((tub_width-(spacing*3))/2)-(cage_wall*2))+2,((tub_length-(spacing*2))-(cage_endwall*2))+2,2], center=false);
}
//spheres lock ins
//1
translate([0,((tub_length-(spacing*2))-(cage_endwall*2))*1/4,((lid_depthinto-divot_height)/2)+(divot_height/2)])
{
divot_sphere();
}
//2
translate([0,((tub_length-(spacing*2))-(cage_endwall*2))*3/4,((lid_depthinto-divot_height)/2)+(divot_height/2)])
{
divot_sphere();
}
//3
translate([((tub_width-(spacing*3))/2)-(cage_wall*2),((tub_length-(spacing*2))-(cage_endwall*2))*1/4,((lid_depthinto-divot_height)/2)+(divot_height/2)])
{
mirror([1,0,0])
{
divot_sphere();
}
}
//4
translate([((tub_width-(spacing*3))/2)-(cage_wall*2),((tub_length-(spacing*2))-(cage_endwall*2))*3/4,((lid_depthinto-divot_height)/2)+(divot_height/2)])
{
mirror([1,0,0])
{
divot_sphere();
}
}
//end spheres
}
//end union begin difference
translate([1,1,1])
{
cube(size = [((tub_width-(spacing*3))/2)-(cage_wall*2)-2,(tub_length-(spacing*2))-(cage_endwall*2)-2,lid_depthinto+3], center=false);
}
//chamfer underside of lip
translate([-2,-1,lid_depthinto-1])
{
rotate([45,0,0])
{
cube(size = [(((tub_width-(spacing*3))/2)-(cage_wall*2))+4,sqrt(2),sqrt(2)], center=false);
}
}
translate([-2,(tub_length-(spacing*2))-(cage_endwall*2)+1,lid_depthinto-1])
{
rotate([45,0,0])
{
cube(size = [(((tub_width-(spacing*3))/2)-(cage_wall*2))+4,sqrt(2),sqrt(2)], center=false);
}
}
translate([-1,-2,lid_depthinto-1])
{
rotate([45,0,90])
{
cube(size = [((tub_length-(spacing*2))-(cage_endwall*2))+4,sqrt(2),sqrt(2)], center=false);
}
}
translate([(((tub_width-(spacing*3))/2)-(cage_wall*2))+1,-2,lid_depthinto-1])
{
rotate([45,0,90])
{
cube(size = [((tub_length-(spacing*2))-(cage_endwall*2))+4,sqrt(2),sqrt(2)], center=false);
}
}
}

//divot
module divot_sphere()
{
difference()
{
translate([(divot_height/2)/sin(45)*sin(45),0,0])
{
sphere(r = (divot_height/2)/sin(45));
}
translate([(divot_height/2)/sin(45),0,0])
cube(size = [((divot_height/2)/sin(45)*2),((divot_height/2)/sin(45)*2),((divot_height/2)/sin(45)*2)], center=true);
}

}

 

big lip with cleat


height = 80;
tub_width = 65;
tub_length = 70;
outsidewall = 5;
basethickness = 5;
tub_wall = 5;

spacing = 5;
cage_height = 60;
cage_wall = 7.5;
cage_endwall = 2;
cage_base = 5;
wedge_hieght = 10;

mesh_opening = 1 ;
mesh_angle = 45;
mesh_spacing = 2.5;

wire_diameter = 2;


union()
{
difference()
{
 union()
  {
//lip
   cube(size = [(tub_width-(spacing*3))/2,tub_length-(spacing*2),2], center=false);
   translate([cage_wall, cage_endwall, 2])
    {
//insert
     cube(size = [((tub_width-(spacing*3))/2)-(cage_wall*2),(tub_length-(spacing*2))-(cage_endwall*2),2], center=false);
    }
  }
 translate([((tub_width-(spacing*3))/2)/2,cage_endwall+2,-3])
  {
   rotate([45,0,90])
    {
//cavity for wire exit and cleat
     cube(size = [((tub_length-(spacing*2))-(cage_endwall*2))-4,(sin(45)*6),(sin(45)*6)], center=false);
    }
  }
//hole for wire
translate([((tub_width-(spacing*3))/2)/2,(tub_length-(spacing*2))/2,-1])
 {
  cylinder(h = 6, r=wire_diameter/2);
 }
}
//cleats

translate([(((tub_width-(spacing*3))/2)/2)-0,((tub_length-(spacing*2))/2)-(wire_diameter*1.5)-3,1.75])
{
mirror([0,0,1])
{
cleat();
}
}

translate([(((tub_width-(spacing*3))/2)/2)-0,((tub_length-(spacing*2))/2)+(wire_diameter*1.5)+3,1.75])
{
mirror([0,0,1])
{
mirror([0,1,0])
{
cleat();
}
}
}

}


////cleat module
module cleat()
 {
  difference()
   {
    cube(size=[2,8,3.5], center=true);
    translate([-0.8,-2,-0.5])
     {
      rotate([0,-20,15])
       {
        cube(size=[2,15,5], center=true);
       }
     }
    translate([0.8,-2,-0.5])
     {    
      rotate([0,20,-15])
       {
        cube(size=[2,15,5], center=true);
       }
     }
    translate([-1.5,4.5,-1])
     {
      rotate([45,0,0])
       {
        cube(size = [3,4,6]);
       }
     }
   }
 }

 

tub

single cell tub

height = 60;
oa_width = 80;
oa_length = 105;
outsidewall = 5;
basethickness = 5;
membranethickness = 5;
tub_wall = 5;

spacing = 5;
cage_height = 40;
cage_wall = 10;
cage_base = 5;

difference()
	{
		cube(size = [oa_width, oa_length, height], center=false);
		translate([outsidewall,outsidewall,basethickness])
			cube(size = [oa_width-(outsidewall*2), oa_length-(outsidewall*2), height-basethickness], center=false);
	}


 

tub with sphere divot

  • incomplete
  • spacer is versine
height = 80;
tub_width = 65;
tub_length = 90;
outsidewall = 5;
basethickness = 5;
tub_wall = 5;

spacing = 5;
cage_height = 60;
cage_wall = 7.5;
cage_endwall = 2;
cage_base = 5;
wedge_hieght = 10;

mesh_opening = 1.5 ;
mesh_angle = 45;
mesh_spacing = 3.5;

wire_diameter = 2;
wire_holeoffc = 0;
lid_depthinto = 7;
divot_height = 5.5;


union()
{
//outerwalls
 difference()
  {
   cube(size = [tub_width, tub_length, height], center=false);
   translate([outsidewall,outsidewall,basethickness])
    {
     cube(size = [tub_width-(outsidewall*2), tub_length-(outsidewall*2), height-basethickness+1], center=false);
    }
  }
//end walls

//begin supports
//1
translate([(tub_width/2)-((spacing-1)/2),tub_wall,height-((spacing+cage_endwall+2)*2)-(sin(45)*(sin(45)*(spacing-1)))-(10)])
{
divider();
}
//2
translate([(tub_width/2)-((spacing-1)/2),tub_wall,height-((spacing+cage_endwall+2)*2)-(sin(45)*(sin(45)*(spacing-1)))-(height*5/8)])
{
divider();
}
//3
translate([(tub_width/2)-((spacing-1)/2),tub_wall+(tub_length-(outsidewall*2)),height-((spacing+cage_endwall+2)*2)-(sin(45)*(sin(45)*(spacing-1)))-(10)])
{
mirror([0,1,0])
{
divider();
}
}
//4
translate([(tub_width/2)-((spacing-1)/2),tub_wall+(tub_length-(outsidewall*2)),height-((spacing+cage_endwall+2)*2)-(sin(45)*(sin(45)*(spacing-1)))-(height*5/8)])
{
mirror([0,1,0])
{
divider();
}
}

//end supports
}

translate([5,-20,0])
{
tub_spacerdivot();
}

//divider modules
module divider()
 {
  difference()
   {
    union()
     {
      cube(size=[spacing-1,spacing+cage_endwall+2,(spacing+cage_endwall+2)*2]);
      translate([0,0,(spacing+cage_endwall+2)*2])
       {
        rotate([0,45,0])
         {
          cube(size=[(sin(45)*(spacing-1)),spacing+cage_endwall+2,(sin(45)*(spacing-1))]);
         }
       }
     }
    translate([0,spacing+cage_endwall+2,-(((spacing+cage_endwall+2)/sin(45))/sin(45))/2])
     {
      rotate([45,0,0])
       {
        cube(size=[spacing-1,((spacing+cage_endwall+2)/sin(45)),((spacing+cage_endwall+2)/sin(45))]);       
       }
     }
   }
 }
//end divider module

//////tub divot
module tub_spacerdivot()
{
difference()
{
translate([(spacing/(1-cos(45)))*sin(45),0,0])
{
sphere(r = (spacing/(1-cos(45))));
}
translate([(spacing/(1-cos(45))),0,0])
{
cube(size = [((spacing/(1-cos(45)))*2),((spacing/(1-cos(45)))*2),((spacing/(1-cos(45)))*2)], center=true);
}
}
}
////end tub divot module

echo(spacing/(1-cos(45)));
 

grooves module

width=10;
height = 92;
tub_wallgroove = 1.5;
wall_length = 115;
////groove module

module grooves(tub_wallgroove,groove_width,groove_length,groove_height,groove_shift)
{
translate([((cos(45)*((groove_height/sin(45))+((groove_width*sin(45)*sin(45))/cos(45)))))-height/2,-.0001,height/2])
{
intersection()
{

intersection()
{
for(g = [(-(cos(45)*((groove_height/sin(45))+((groove_width*sin(45)*sin(45))/cos(45))))/groove_width/2) : (groove_length/groove_width/2)])
{
 translate([(g*groove_width*2)+(groove_width*sin(45)*sin(45)),0,groove_shift])
  {
  rotate([0,45,0])
   {
    rotate([0,0,45])
     {
      #cube(size = [groove_width*sin(45)*sin(45),groove_width*sin(45)*sin(45),((groove_height/sin(45))+((groove_width*sin(45)*sin(45))/cos(45)))+(abs(groove_shift/cos(45)*2))], center=true);
     }
   }
  }
}
translate([(-groove_height/2)-(groove_width*sin(45)*sin(45)),0,-groove_height/2])
{
#cube(size = [groove_length,tub_wallgroove,groove_height]);
}
}
translate([((-groove_height/2)-(groove_width*sin(45)*sin(45)))+(groove_length/2),0,0])
{
rotate([0,0,45])
{
cube(size = [groove_length*cos(45),groove_length*cos(45),groove_height],center=true);
}
}

 }//end intersection
}
}
////end groove mdoule


#if(grooves_yn==1)grooves(tub_wallgroovedepth,tub_wallgroovewidth,(((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall),height,tub_wallgrooveshift);

 

groove module with angle

  • still buggy
height = 90;
tub_width = 36;
tub_length = 70;
basethickness = 5;
tub_wall = 2;
tub_outsidewall = 4;
tub_wallgroovedepth = 1.5;
tub_wallgroovewidth = 10;
tub_wallgroovecorners = 4;
grooves_yn = 1; //1 yes 0 no

eyelets_rowside = 2;
eyelets_columnside = 3;

eyelets_belowtop = 10;
eyelets_walltoceneter = 5;
eyelets_od = 7;
eyelets_id = 3;
eyelets_width = 5;

tubs_rows    = 4;
tubs_columns = 2;

spacing = 1.940055;
wall_spacers_yn = 0; //1 yes 0 no
center_dividers = 0; //1 yes 0 no
cage_height = 60;
cage_wall = 5.5;
cage_endwall = 2;
cage_base = 5;

mesh_opening = 1.5 ;
mesh_angle = 45;
mesh_spacing = 3.5;

wire_diameter = 2;
wire_holeoffc = 0;
cage_lid_depthinto = 7;
cage_divot_height = 5.5;
tub_lid_depthinto = 7;
tub_divot_height = 5.5;

////groove module

module grooves(tub_wallgroove,groove_width,groove_length,groove_height,groove_shift,groove_angle)
{
translate([((cos(groove_angle)*((groove_height/cos(groove_angle))+((groove_width*tan(groove_angle))))))-height/2,-.0001,height/2]) //problem here
{
intersection()
{

intersection()
{
for(g = [(-(tan(groove_angle)*((groove_height/tan(groove_angle))+((groove_width*sin(groove_angle)*sin(groove_angle))*tan(groove_angle))))/groove_width/2) : (groove_length/groove_width/2)]) //got a problem here
{
 translate([(g*groove_width*2)+(groove_width*sin(45)*cos(groove_angle)),0,groove_shift])
  {
  rotate([0,groove_angle,0])
   {
    rotate([0,0,45])
     {
      #cube(size = [groove_width*cos(groove_angle)*cos(45),groove_width*cos(groove_angle)*cos(45),(groove_height/cos(groove_angle))+(sin(groove_angle)*groove_width)+(abs(groove_shift/cos(groove_angle)*2))], center=true);
     }
   }
  }
}
translate([(-groove_height/2)-(groove_width*sin(groove_angle)*sin(groove_angle)),0,-groove_height/2])
{
#cube(size = [groove_length,tub_wallgroove,groove_height]);
}
}
translate([((-groove_height/2)-(groove_width*sin(groove_angle)*sin(groove_angle)))+(groove_length/2),0,0])
{
rotate([0,0,45])
{
cube(size = [groove_length*cos(45),groove_length*cos(45),groove_height],center=true);
}
}

 }//end intersection
}
}
////end groove mdoule


#if(grooves_yn==1)grooves(tub_wallgroovedepth,tub_wallgroovewidth,(((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall),height,0,45);

cube(10);
 

groove module with angle - rework

  • need to tweak so variable angle shifts top edge not bottom
height = 90;
tub_width = 36;
tub_length = 70;
basethickness = 5;
tub_wall = 2;
tub_outsidewall = 4;
tub_wallgroovedepth = 1.5;
tub_wallgroovewidth = 10;
tub_wallgroovecorners = 4;
grooves_yn = 1; //1 yes 0 no

eyelets_rowside = 2;
eyelets_columnside = 3;

eyelets_belowtop = 10;
eyelets_walltoceneter = 5;
eyelets_od = 7;
eyelets_id = 3;
eyelets_width = 5;

tubs_rows    = 4;
tubs_columns = 2;

spacing = 1.940055;
wall_spacers_yn = 0; //1 yes 0 no
center_dividers = 0; //1 yes 0 no
cage_height = 60;
cage_wall = 5.5;
cage_endwall = 2;
cage_base = 5;

mesh_opening = 1.5 ;
mesh_angle = 45;
mesh_spacing = 3.5;

wire_diameter = 2;
wire_holeoffc = 0;
cage_lid_depthinto = 7;
cage_divot_height = 5.5;
tub_lid_depthinto = 7;
tub_divot_height = 5.5;

module grooves(tub_wallgroove,groove_width,groove_length,groove_height,groove_shift,groove_angle)

intersection()
{
for(g = [0 : 2+((groove_length/groove_width)+((tan(groove_angle)*groove_height)/groove_width))/2])
{
 translate([(g*groove_width*2),0,groove_shift])
  {
translate([(sin(groove_angle)*(-((groove_height/cos(groove_angle))+(sin(groove_angle)*groove_width)+(abs(groove_shift/cos(groove_angle)*2)))/2))-((groove_width*cos(groove_angle)*cos(45))*sin(45)*cos(groove_angle)),0,groove_height/2])
{

  rotate([0,groove_angle,0])
   {
    rotate([0,0,45])
     {
      #cube(size = [groove_width*cos(groove_angle)*cos(45),groove_width*cos(groove_angle)*cos(45),(groove_height/cos(groove_angle))+(sin(groove_angle)*groove_width)+(abs(groove_shift/cos(groove_angle)*2))], center=true);
     }
   }
}
}
}
#cube(size = [groove_length,tub_wallgroove,groove_height]);

translate([groove_length/2,0,groove_height/2])
{
rotate([0,0,45])
{
cube(size = [groove_length*cos(45),groove_length*cos(45),groove_height],center=true);
}
}

}//end module


#if(grooves_yn==1)grooves(tub_wallgroovedepth,tub_wallgroovewidth,(((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall),height,0,45);

cube(10);

 

tub with grooves

height = 90;
tub_width = 36;
tub_length = 70;
basethickness = 5;
tub_wall = 2;
tub_outsidewall = 4;
tub_wallgroovedepth = 1.5;
tub_wallgroovewidth = 15;
tub_wallgroovecorners =4;
grooves_yn = 1; //1 yes 0 no

tubs_rows    = 2;
tubs_columns = 2;

spacing = 1.940055;
wall_spacers_yn = 0; //1 yes 0 no
center_dividers = 0; //1 yes 0 no
cage_height = 60;
cage_wall = 5.5;
cage_endwall = 2;
cage_base = 5;

mesh_opening = 1.5 ;
mesh_angle = 45;
mesh_spacing = 3.5;

wire_diameter = 2;
wire_holeoffc = 0;
cage_lid_depthinto = 7;
cage_divot_height = 5.5;
tub_lid_depthinto = 7;
tub_divot_height = 5.5;


difference()
{
union()
 {

//tubs
for (c = [0 : tubs_columns-1])
 {
  translate([0,c*(tub_length+tub_wall),0])
   {
    for (r = [0 : tubs_rows-1])
    {
     translate([r*(tub_width+tub_wall),0,0])
      {
       tub();
      }
    }
   }
 }
//end tubs

//outer walls
translate([-tub_outsidewall+tub_wall,-tub_outsidewall+tub_wall,0])
 {
  difference()
   {
    cube(size = [((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall,((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall,height]);
    translate([tub_outsidewall,tub_outsidewall,0])
     {
      #cube(size = [(((tub_width+tub_wall)*tubs_rows)+tub_wall)-(tub_wall*2),(((tub_length+tub_wall)*tubs_columns)+tub_wall)-(tub_wall*2),height+1]);
     }
   }
 }

//end outer walls

} //end union

////grooves
//1
rotate([0,0,0])
{
translate([tub_wall-tub_outsidewall+(tub_wallgroovecorners/2),tub_wall-tub_outsidewall,0])
{
if(grooves_yn==1)grooves(tub_wallgroovedepth,tub_wallgroovewidth,(((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners,height);
}
}
//2
rotate([0,0,90])
{
translate([(tub_wall-tub_outsidewall)+(tub_wallgroovecorners/2),-(tub_wall-tub_outsidewall)-(((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall),0])
{
#if(grooves_yn==1)grooves(tub_wallgroovedepth,tub_wallgroovewidth,((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall-tub_wallgroovecorners,height);
}
}
//3
rotate([0,0,180])
{
translate([-(tub_wall-tub_outsidewall)-(tub_wallgroovecorners/2)-((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners),-tub_wall-tub_outsidewall-((((tub_length+tub_wall)*tubs_columns)+tub_wall)-(tub_wall*2)),0])
{
#if(grooves_yn==1)grooves(tub_wallgroovedepth,tub_wallgroovewidth,(((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners,height);
}
}
//4
rotate([0,0,270])
{
translate([-tub_wall-tub_outsidewall-((((tub_length+tub_wall)*tubs_columns)+tub_wall)-(tub_wall*2))+(tub_wallgroovecorners/2),(tub_wall-tub_outsidewall),0])
{
#if(grooves_yn==1)grooves(tub_wallgroovedepth,tub_wallgroovewidth,((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall-tub_wallgroovecorners,height);
}
}

////end grooves


} //end difference


//////end render
//////begin modules

////tub module
module tub()
{
union()
{
//walls
 difference()
  {
   cube(size = [tub_width+(tub_wall*2), tub_length+(tub_wall*2), height], center=false);
   translate([tub_wall,tub_wall,basethickness])
    {
     cube(size = [tub_width, tub_length, height-basethickness+1], center=false);
    }
  }
//end walls

//spheres lock ins
//1
      translate([tub_wall,(tub_length*1/4)+tub_wall,height-(((tub_lid_depthinto-tub_divot_height)/2)+(tub_divot_height/2))])
       {
        mirror([1,0,0])
         {
          #divot_sphere();
         }
       }
//2
      translate([tub_wall,(tub_length*3/4)+tub_wall,height-(((tub_lid_depthinto-tub_divot_height)/2)+(tub_divot_height/2))])
       {
        mirror([1,0,0])
         {
          divot_sphere();
         }
       }
//3
      translate([tub_width+tub_wall,(tub_length*1/4)+tub_wall,height-(((tub_lid_depthinto-tub_divot_height)/2)+(tub_divot_height/2))])
       {
        mirror([0,0,0])
         {
          divot_sphere();
         }
       }
//4
      translate([tub_width+tub_wall,(tub_length*3/4)+tub_wall,height-(((tub_lid_depthinto-tub_divot_height)/2)+(tub_divot_height/2))])
       {
        mirror([0,0,0])
         {
          divot_sphere();
         }
       }
//5
      translate([(tub_width*1/2)+tub_wall,tub_wall,height-(((tub_lid_depthinto-tub_divot_height)/2)+(tub_divot_height/2))])
       {
        mirror([0,1,0])
         {
          rotate([0,0,90])
           {
            #divot_sphere();
           }
         }
       }
//6
      translate([(tub_width*1/2)+tub_wall,tub_length+tub_wall,height-(((tub_lid_depthinto-tub_divot_height)/2)+(tub_divot_height/2))])
       {
        mirror([0,0,0])
         {
          rotate([0,0,90])
           {
            #divot_sphere();
           }
         }
       }
//end spheres

//begin spacers
//1
translate([((tub_width+(tub_wall*2))/2)-((spacing-1)/2),tub_wall,cage_height*4/5])
{
if (center_dividers==1) divider();
}
//2
translate([((tub_width+(tub_wall*2))/2)-((spacing-1)/2),tub_wall,height-((spacing+cage_endwall+2)*2)-(sin(45)*(sin(45)*(spacing-1)))-(height*5/8)])
{
if (center_dividers==1) divider();
}
//3
translate([((tub_width+(tub_wall*2))/2)-((spacing-1)/2),tub_length+tub_wall,cage_height*4/5])
{
mirror([0,1,0])
{
if (center_dividers==1) divider();
}
}
//4
translate([((tub_width+(tub_wall*2))/2)-((spacing-1)/2),tub_length+tub_wall,height-((spacing+cage_endwall+2)*2)-(sin(45)*(sin(45)*(spacing-1)))-(height*5/8)])
{
mirror([0,1,0])
{
if (center_dividers==1) divider();
}
}
//the end_wall's side spacers
//s1
translate([(tub_width+(tub_wall*2))*1/4,tub_wall,(cage_height/2)+basethickness])
{
rotate([0,0,90])
{
if (wall_spacers_yn==1) tub_spacer(8);
}
}
//s2
translate([(tub_width+(tub_wall*2))*3/4,tub_wall,(cage_height/2)+basethickness])
{
rotate([0,0,90])
{
if (wall_spacers_yn==1) tub_spacer(8);
}
}
//s3
translate([(tub_width+(tub_wall*2))*1/4,tub_wall+tub_length,(cage_height/2)+basethickness])
{
rotate([0,0,270])
{
if (wall_spacers_yn==1) tub_spacer(8);
}
}
//s4
translate([(tub_width+(tub_wall*2))*3/4,tub_wall+tub_length,(cage_height/2)+basethickness])
{
rotate([0,0,270])
{
if (wall_spacers_yn==1) tub_spacer(8);
}
}

//walls spacers
//w1
translate([tub_wall,(tub_length+(tub_wall*2))/2,(cage_height/2)+basethickness])
{
rotate([0,0,0])
{
if (wall_spacers_yn==1) tub_spacer(8);
}
}
//w2
translate([(tub_width+tub_wall),(tub_length+(tub_wall*2))/2,(cage_height/2)+basethickness])
{
rotate([0,0,180])
{
if (wall_spacers_yn==1) tub_spacer(8);
}
}
//base spacers
//b1
translate([(tub_width+(tub_wall*2))/2,(tub_length+(tub_wall*2))*1/5,basethickness])
{
rotate([0,270,90])
{
tub_spacer(tub_width-(spacing*2));
}
}
//b2
translate([(tub_width+(tub_wall*2))/2,(tub_length+(tub_wall*2))*4/5,basethickness])
{
rotate([0,270,90])
{
tub_spacer(tub_width-(spacing*2));
}
}

//end spacers
}
}
////end tub module


//divider modules
module divider()
 {
  difference()
   {
    union()
     {
      cube(size=[spacing-1,spacing+cage_endwall+2,(spacing+cage_endwall+2)*2]);
      translate([0,0,(spacing+cage_endwall+2)*2])
       {
        rotate([0,45,0])
         {
          cube(size=[(sin(45)*(spacing-1)),spacing+cage_endwall+2,(sin(45)*(spacing-1))]);
         }
       }
     }
    translate([0,spacing+cage_endwall+2,-(((spacing+cage_endwall+2)/sin(45))/sin(45))/2])
     {
      rotate([45,0,0])
       {
        cube(size=[spacing-1,((spacing+cage_endwall+2)/sin(45)),((spacing+cage_endwall+2)/sin(45))]);       
       }
     }
   }
 }
//end divider module

//spacer module
module tub_spacer(length)
 {
translate([-(spacing-1),-length/2,0])
  {
  difference()
   {
    rotate([0,45,0])
     {
      cube(size = [((spacing-1)/sin(45)),length,((spacing-1)/sin(45))]);
     }
    translate([-(spacing-1)-0.1,0,-(spacing-1)])
     {
      #cube(size = [((spacing-1)/sin(45))/sin(45),length,((spacing-1)/sin(45))/sin(45)]);
     }
   }
 }
}
//end spacer

//divot
module divot_sphere()
{
difference()
{
translate([(tub_divot_height/2)/sin(45)*sin(45),0,0])
{
sphere(r = (tub_divot_height/2)/sin(45));
}
translate([(tub_divot_height/2)/sin(45),0,0])
cube(size = [((tub_divot_height/2)/sin(45)*2),((tub_divot_height/2)/sin(45)*2),((tub_divot_height/2)/sin(45)*2)], center=true);
}
}
//end divot module

////groove module

module grooves(tub_wallgroove,groove_width,groove_length,groove_height)
{
translate([((cos(45)*((groove_height/sin(45))+((groove_width*sin(45)*sin(45))/cos(45)))))-height/2,-.0001,height/2])
{
intersection()
{

intersection()
{
for(g = [(-(cos(45)*((groove_height/sin(45))+((groove_width*sin(45)*sin(45))/cos(45))))/groove_width/2) : (groove_length/groove_width/2)])
{
 translate([(g*groove_width*2)+(groove_width*sin(45)*sin(45)),0,0])
  {
  rotate([0,45,0])
   {
    rotate([0,0,45])
     {
      #cube(size = [groove_width*sin(45)*sin(45),groove_width*sin(45)*sin(45),(groove_height/sin(45))+((groove_width*sin(45)*sin(45))/cos(45))], center=true);
     }
   }
  }
}
translate([(-groove_height/2)-(groove_width*sin(45)*sin(45)),0,-groove_height/2])
{
#cube(size = [groove_length,tub_wallgroove,groove_height]);
}
}
translate([((-groove_height/2)-(groove_width*sin(45)*sin(45)))+(groove_length/2),0,0])
{
rotate([0,0,45])
{
#cube(size = [groove_length*cos(45),groove_length*cos(45),groove_height],center=true);
}
}

 }//end intersection
}
}
////end groove mdoule

////calculations

echo("space above cages for extra fluid is", height-basethickness-spacing-cage_height-tub_lid_depthinto);


echo("tub print area x",((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall);

echo("tub print area y",((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall);

echo("tub print area z",height);

echo("cage cavity y",((tub_width-(spacing*3))/2)-(cage_wall*2));

echo("cage cavity x",(tub_length-(spacing*2))-(cage_endwall*2));

echo("cage cavity z",cage_height-cage_base);

echo("powder volume per cage",((((tub_width-(spacing*3))/2)-(cage_wall*2)))/10*(((tub_length-(spacing*2))-(cage_endwall*2)))/10*(cage_height-cage_base-cage_lid_depthinto)/10,"cm3");

echo("grams nickle hydroxide per cage",(((((tub_width-(spacing*3))/2)-(cage_wall*2)))/10*(((tub_length-(spacing*2))-(cage_endwall*2)))/10*(cage_height-cage_base-cage_lid_depthinto)/10)*(4.10),"grams");//density is 4.10

echo("total grams nickle hydroxide",(((((tub_width-(spacing*3))/2)-(cage_wall*2)))/10*(((tub_length-(spacing*2))-(cage_endwall*2)))/10*(cage_height-cage_base-cage_lid_depthinto)/10)*(4.10)*(tubs_columns*tubs_rows),"grams");






 

tub with grooves and eyelets

height = 90;
tub_width = 36;
tub_length = 70;
basethickness = 5;
tub_wall = 2;
tub_outsidewall = 4;
tub_wallgroovedepth = 1.5;
tub_wallgroovewidth = 15;
tub_wallgroovecorners =4;
grooves_yn = 1; //1 yes 0 no

eyelets_rowside = 2;
eyelets_columnside = 3;

eyelets_belowtop = 10;
eyelets_walltoceneter = 5;
eyelets_od = 7;
eyelets_id = 3;
eyelets_width = 5;

tubs_rows    = 4;
tubs_columns = 2;

spacing = 1.940055;
wall_spacers_yn = 0; //1 yes 0 no
center_dividers = 0; //1 yes 0 no
cage_height = 60;
cage_wall = 5.5;
cage_endwall = 2;
cage_base = 5;

mesh_opening = 1.5 ;
mesh_angle = 45;
mesh_spacing = 3.5;

wire_diameter = 2;
wire_holeoffc = 0;
cage_lid_depthinto = 7;
cage_divot_height = 5.5;
tub_lid_depthinto = 7;
tub_divot_height = 5.5;

union()//eyelets
{
difference()//grooves
{
union()
 {

//tubs
for (c = [0 : tubs_columns-1])
 {
  translate([0,c*(tub_length+tub_wall),0])
   {
    for (r = [0 : tubs_rows-1])
    {
     translate([r*(tub_width+tub_wall),0,0])
      {
       tub();
      }
    }
   }
 }
//end tubs

//outer walls
translate([-tub_outsidewall+tub_wall,-tub_outsidewall+tub_wall,0])
 {
  difference()
   {
    cube(size = [((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall,((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall,height]);
    translate([tub_outsidewall,tub_outsidewall,0])
     {
      cube(size = [(((tub_width+tub_wall)*tubs_rows)+tub_wall)-(tub_wall*2),(((tub_length+tub_wall)*tubs_columns)+tub_wall)-(tub_wall*2),height+1]);
     }
   }
 }

//end outer walls

} //end union

////grooves
//1
rotate([0,0,0])
{
translate([tub_wall-tub_outsidewall+(tub_wallgroovecorners/2),tub_wall-tub_outsidewall,0])
{
if(grooves_yn==1)grooves(tub_wallgroovedepth,tub_wallgroovewidth,(((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners,height,0);
}
}
//2
rotate([0,0,90])
{
translate([(tub_wall-tub_outsidewall)+(tub_wallgroovecorners/2),-(tub_wall-tub_outsidewall)-(((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall),0])
{
if(grooves_yn==1)grooves(tub_wallgroovedepth,tub_wallgroovewidth,((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall-tub_wallgroovecorners,height,(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth);
}
}
//3
rotate([0,0,180])
{
translate([-(tub_wall-tub_outsidewall)-(tub_wallgroovecorners/2)-((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners),-tub_wall-tub_outsidewall-((((tub_length+tub_wall)*tubs_columns)+tub_wall)-(tub_wall*2)),0])
{
if(grooves_yn==1)grooves(tub_wallgroovedepth,tub_wallgroovewidth,(((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners,height,(((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth)+((((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth))-((2*tub_wallgroovewidth)*floor(((((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth)+((((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth))/(2*tub_wallgroovewidth)))));
}
}
//4
rotate([0,0,270])
{
translate([-tub_wall-tub_outsidewall-((((tub_length+tub_wall)*tubs_columns)+tub_wall)-(tub_wall*2))+(tub_wallgroovecorners/2),(tub_wall-tub_outsidewall),0])
{
if(grooves_yn==1)grooves(tub_wallgroovedepth,tub_wallgroovewidth,((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall-tub_wallgroovecorners,height,0);
}
}

////end grooves
} //end difference
//begin eyelets
//1 rowside
translate([(tub_wall-tub_outsidewall),(tub_wall-tub_outsidewall)-eyelets_walltoceneter,height-eyelets_belowtop])
{
for (e = [1:eyelets_rowside])
{
translate([(((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)/(eyelets_rowside+1)*e,0,0])
{
rotate([0,0,180])
{
eyelet(eyelets_od,eyelets_id,eyelets_width,tub_wallgroovedepth+eyelets_walltoceneter-(eyelets_od/2));
}
}
}
}
//2
//3
translate([(tub_wall-tub_outsidewall),((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2),height-eyelets_belowtop])
{
for (e = [1:eyelets_rowside])
{
translate([(((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)/(eyelets_rowside+1)*e,0,0])
{
rotate([0,0,0])
{
#eyelet(eyelets_od,eyelets_id,eyelets_width,tub_wallgroovedepth+eyelets_walltoceneter-(eyelets_od/2));
}
}
}
}
//4

//end eyelets
} //end union



//////end render
//////begin modules

////tub module
module tub()
{
union()
{
//walls
 difference()
  {
   cube(size = [tub_width+(tub_wall*2), tub_length+(tub_wall*2), height], center=false);
   translate([tub_wall,tub_wall,basethickness])
    {
     cube(size = [tub_width, tub_length, height-basethickness+1], center=false);
    }
  }
//end walls

//spheres lock ins
//1
      translate([tub_wall,(tub_length*1/4)+tub_wall,height-(((tub_lid_depthinto-tub_divot_height)/2)+(tub_divot_height/2))])
       {
        mirror([1,0,0])
         {
          #divot_sphere();
         }
       }
//2
      translate([tub_wall,(tub_length*3/4)+tub_wall,height-(((tub_lid_depthinto-tub_divot_height)/2)+(tub_divot_height/2))])
       {
        mirror([1,0,0])
         {
          divot_sphere();
         }
       }
//3
      translate([tub_width+tub_wall,(tub_length*1/4)+tub_wall,height-(((tub_lid_depthinto-tub_divot_height)/2)+(tub_divot_height/2))])
       {
        mirror([0,0,0])
         {
          divot_sphere();
         }
       }
//4
      translate([tub_width+tub_wall,(tub_length*3/4)+tub_wall,height-(((tub_lid_depthinto-tub_divot_height)/2)+(tub_divot_height/2))])
       {
        mirror([0,0,0])
         {
          divot_sphere();
         }
       }
//5
      translate([(tub_width*1/2)+tub_wall,tub_wall,height-(((tub_lid_depthinto-tub_divot_height)/2)+(tub_divot_height/2))])
       {
        mirror([0,1,0])
         {
          rotate([0,0,90])
           {
            #divot_sphere();
           }
         }
       }
//6
      translate([(tub_width*1/2)+tub_wall,tub_length+tub_wall,height-(((tub_lid_depthinto-tub_divot_height)/2)+(tub_divot_height/2))])
       {
        mirror([0,0,0])
         {
          rotate([0,0,90])
           {
            #divot_sphere();
           }
         }
       }
//end spheres

//begin spacers
//1
translate([((tub_width+(tub_wall*2))/2)-((spacing-1)/2),tub_wall,cage_height*4/5])
{
if (center_dividers==1) divider();
}
//2
translate([((tub_width+(tub_wall*2))/2)-((spacing-1)/2),tub_wall,height-((spacing+cage_endwall+2)*2)-(sin(45)*(sin(45)*(spacing-1)))-(height*5/8)])
{
if (center_dividers==1) divider();
}
//3
translate([((tub_width+(tub_wall*2))/2)-((spacing-1)/2),tub_length+tub_wall,cage_height*4/5])
{
mirror([0,1,0])
{
if (center_dividers==1) divider();
}
}
//4
translate([((tub_width+(tub_wall*2))/2)-((spacing-1)/2),tub_length+tub_wall,height-((spacing+cage_endwall+2)*2)-(sin(45)*(sin(45)*(spacing-1)))-(height*5/8)])
{
mirror([0,1,0])
{
if (center_dividers==1) divider();
}
}
//the end_wall's side spacers
//s1
translate([(tub_width+(tub_wall*2))*1/4,tub_wall,(cage_height/2)+basethickness])
{
rotate([0,0,90])
{
if (wall_spacers_yn==1) tub_spacer(8);
}
}
//s2
translate([(tub_width+(tub_wall*2))*3/4,tub_wall,(cage_height/2)+basethickness])
{
rotate([0,0,90])
{
if (wall_spacers_yn==1) tub_spacer(8);
}
}
//s3
translate([(tub_width+(tub_wall*2))*1/4,tub_wall+tub_length,(cage_height/2)+basethickness])
{
rotate([0,0,270])
{
if (wall_spacers_yn==1) tub_spacer(8);
}
}
//s4
translate([(tub_width+(tub_wall*2))*3/4,tub_wall+tub_length,(cage_height/2)+basethickness])
{
rotate([0,0,270])
{
if (wall_spacers_yn==1) tub_spacer(8);
}
}

//walls spacers
//w1
translate([tub_wall,(tub_length+(tub_wall*2))/2,(cage_height/2)+basethickness])
{
rotate([0,0,0])
{
if (wall_spacers_yn==1) tub_spacer(8);
}
}
//w2
translate([(tub_width+tub_wall),(tub_length+(tub_wall*2))/2,(cage_height/2)+basethickness])
{
rotate([0,0,180])
{
if (wall_spacers_yn==1) tub_spacer(8);
}
}
//base spacers
//b1
translate([(tub_width+(tub_wall*2))/2,(tub_length+(tub_wall*2))*1/5,basethickness])
{
rotate([0,270,90])
{
tub_spacer(tub_width-(spacing*2));
}
}
//b2
translate([(tub_width+(tub_wall*2))/2,(tub_length+(tub_wall*2))*4/5,basethickness])
{
rotate([0,270,90])
{
tub_spacer(tub_width-(spacing*2));
}
}

//end spacers
}
}
////end tub module


//divider modules
module divider()
 {
  difference()
   {
    union()
     {
      cube(size=[spacing-1,spacing+cage_endwall+2,(spacing+cage_endwall+2)*2]);
      translate([0,0,(spacing+cage_endwall+2)*2])
       {
        rotate([0,45,0])
         {
          cube(size=[(sin(45)*(spacing-1)),spacing+cage_endwall+2,(sin(45)*(spacing-1))]);
         }
       }
     }
    translate([0,spacing+cage_endwall+2,-(((spacing+cage_endwall+2)/sin(45))/sin(45))/2])
     {
      rotate([45,0,0])
       {
        cube(size=[spacing-1,((spacing+cage_endwall+2)/sin(45)),((spacing+cage_endwall+2)/sin(45))]);       
       }
     }
   }
 }
//end divider module

//spacer module
module tub_spacer(length)
 {
translate([-(spacing-1),-length/2,0])
  {
  difference()
   {
    rotate([0,45,0])
     {
      cube(size = [((spacing-1)/sin(45)),length,((spacing-1)/sin(45))]);
     }
    translate([-(spacing-1)-0.1,0,-(spacing-1)])
     {
      #cube(size = [((spacing-1)/sin(45))/sin(45),length,((spacing-1)/sin(45))/sin(45)]);
     }
   }
 }
}
//end spacer

//divot
module divot_sphere()
{
difference()
{
translate([(tub_divot_height/2)/sin(45)*sin(45),0,0])
{
sphere(r = (tub_divot_height/2)/sin(45));
}
translate([(tub_divot_height/2)/sin(45),0,0])
cube(size = [((tub_divot_height/2)/sin(45)*2),((tub_divot_height/2)/sin(45)*2),((tub_divot_height/2)/sin(45)*2)], center=true);
}
}
//end divot module

////groove module

module grooves(tub_wallgroove,groove_width,groove_length,groove_height,groove_shift)
{
translate([((cos(45)*((groove_height/sin(45))+((groove_width*sin(45)*sin(45))/cos(45)))))-height/2,-.0001,height/2])
{
intersection()
{

intersection()
{
for(g = [(-(cos(45)*((groove_height/sin(45))+((groove_width*sin(45)*sin(45))/cos(45))))/groove_width/2) : (groove_length/groove_width/2)])
{
 translate([(g*groove_width*2)+(groove_width*sin(45)*sin(45)),0,groove_shift])
  {
  rotate([0,45,0])
   {
    rotate([0,0,45])
     {
      #cube(size = [groove_width*sin(45)*sin(45),groove_width*sin(45)*sin(45),((groove_height/sin(45))+((groove_width*sin(45)*sin(45))/cos(45)))+(abs(groove_shift/cos(45)*2))], center=true);
     }
   }
  }
}
translate([(-groove_height/2)-(groove_width*sin(45)*sin(45)),0,-groove_height/2])
{
#cube(size = [groove_length,tub_wallgroove,groove_height]);
}
}
translate([((-groove_height/2)-(groove_width*sin(45)*sin(45)))+(groove_length/2),0,0])
{
rotate([0,0,45])
{
cube(size = [groove_length*cos(45),groove_length*cos(45),groove_height],center=true);
}
}

 }//end intersection
}
}
////end groove mdoule

////begin eyelet module

module eyelet(od,id,eyelet_width,standoff)
{

translate([-eyelet_width/2,-(od/2)-standoff,-((od)+od)-standoff+(od/2)])//orgin set at the center of hole cylinder
{
difference()
   {
    union()
     {
      translate([0,standoff,standoff])
       {
        cube(size=[eyelet_width,od,(od/2)+od]);
       }
      translate([0,((od)/2)+standoff,((od/2)+od)+standoff])
       {
        rotate([0,90,0])
         {
          cylinder(r = od/2,h = eyelet_width, $fn=60);
         }
       }
      translate([0,0,0])
       {
        cube(size=[eyelet_width,(od/2)+standoff,((od)+od)+standoff]);
       } 
     }
    translate([-1,eyelet_width+2,-(((eyelet_width+2)/sin(45))/sin(45))/2])
     {
      rotate([45,0,0])
       {
        #cube(size=[eyelet_width+2,((od+standoff+2)/sin(45)),((eyelet_width+2)/sin(45))]);       
       }
     }
      translate([-1,((od)/2)+standoff,((od/2)+od)+standoff])
       {
        rotate([0,90,0])
         {
          cylinder(r = id/2,h = eyelet_width+2, $fn=60);
         }
       }

   }
  }
}

////end eyelet module

////calculations

echo("space above cages for extra fluid is", height-basethickness-spacing-cage_height-tub_lid_depthinto);


echo("tub print area x",((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall);

echo("tub print area y",((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall);

echo("tub print area z",height);

echo("cage cavity y",((tub_width-(spacing*3))/2)-(cage_wall*2));

echo("cage cavity x",(tub_length-(spacing*2))-(cage_endwall*2));

echo("cage cavity z",cage_height-cage_base);

echo("powder volume per cage",((((tub_width-(spacing*3))/2)-(cage_wall*2)))/10*(((tub_length-(spacing*2))-(cage_endwall*2)))/10*(cage_height-cage_base-cage_lid_depthinto)/10,"cm3");

echo("grams nickle hydroxide per cage",(((((tub_width-(spacing*3))/2)-(cage_wall*2)))/10*(((tub_length-(spacing*2))-(cage_endwall*2)))/10*(cage_height-cage_base-cage_lid_depthinto)/10)*(4.10),"grams");//density is 4.10

echo("total grams nickle hydroxide",(((((tub_width-(spacing*3))/2)-(cage_wall*2)))/10*(((tub_length-(spacing*2))-(cage_endwall*2)))/10*(cage_height-cage_base-cage_lid_depthinto)/10)*(4.10)*(tubs_columns*tubs_rows),"grams");

echo(((((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/tub_wallgroovewidth)-floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/tub_wallgroovewidth))*tub_wallgroovewidth)+tub_wallgroovewidth));

//2
echo((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth);

//3
echo((((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth);

//2+3
echo(((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth)+((((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth));

//(2+3)/absfloor
echo((2*tub_wallgroovewidth)*floor(((((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth)+((((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth))/(2*tub_wallgroovewidth))));

//3
echo((((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth)+((((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth))-((2*tub_wallgroovewidth)*floor(((((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth)+((((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth))/(2*tub_wallgroovewidth)))));

 

tub with grooves eyelits slidelocks

update 20150120

in progress. needs updated grooves.

height = 90;
tub_width = 36;
tub_length = 70;
basethickness = 5;
tub_wall = 2;
tub_outsidewall = 4;
tub_wallgroovedepth = 1.5;
tub_wallgroovewidth = 15;
tub_wallgroovecorners =4;
grooves_yn = 1; //1 yes 0 no

eyelets_rowside = 2;
eyelets_columnside = 3;

eyelets_belowtop = 10;
eyelets_walltoceneter = 5;
eyelets_od = 7;
eyelets_id = 3;
eyelets_width = 5;

tubs_rows    = 1;
tubs_columns = 1;

spacing = 1.940055;
wall_spacers_yn = 0; //1 yes 0 no
center_dividers = 0; //1 yes 0 no
cage_height = 60;
cage_wall = 5.5;
cage_endwall = 2;
cage_base = 5;

mesh_opening = 1.5 ;
mesh_angle = 45;
mesh_spacing = 3.5;

wire_diameter = 2;
wire_holeoffc = 0;
cage_lid_depthinto = 7;
cage_divot_height = 5.5;
tub_lid_depthinto = 7;
tub_divot_height = 5.5;

union()//eyelets
{
difference()//grooves
{
union()
 {

//tubs
for (c = [0 : tubs_columns-1])
 {
  translate([0,c*(tub_length+tub_wall),0])
   {
    for (r = [0 : tubs_rows-1])
    {
     translate([r*(tub_width+tub_wall),0,0])
      {
       tub();
      }
    }
   }
 }
//end tubs

//outer walls
translate([-tub_outsidewall+tub_wall,-tub_outsidewall+tub_wall,0])
 {
  difference()
   {
    cube(size = [((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall,((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall,height]);
    translate([tub_outsidewall,tub_outsidewall,0])
     {
      cube(size = [(((tub_width+tub_wall)*tubs_rows)+tub_wall)-(tub_wall*2),(((tub_length+tub_wall)*tubs_columns)+tub_wall)-(tub_wall*2),height+1]);
     }
   }
 }

//end outer walls

} //end union

////grooves
//1
rotate([0,0,0])
{
translate([tub_wall-tub_outsidewall+(tub_wallgroovecorners/2),tub_wall-tub_outsidewall,0])
{
if(grooves_yn==1)grooves(tub_wallgroovedepth,tub_wallgroovewidth,(((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners,height,0);
}
}
//2
rotate([0,0,90])
{
translate([(tub_wall-tub_outsidewall)+(tub_wallgroovecorners/2),-(tub_wall-tub_outsidewall)-(((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall),0])
{
if(grooves_yn==1)grooves(tub_wallgroovedepth,tub_wallgroovewidth,((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall-tub_wallgroovecorners,height,(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth);
}
}
//3
rotate([0,0,180])
{
translate([-(tub_wall-tub_outsidewall)-(tub_wallgroovecorners/2)-((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners),-tub_wall-tub_outsidewall-((((tub_length+tub_wall)*tubs_columns)+tub_wall)-(tub_wall*2)),0])
{
if(grooves_yn==1)grooves(tub_wallgroovedepth,tub_wallgroovewidth,(((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners,height,(((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth)+((((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth))-((2*tub_wallgroovewidth)*floor(((((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth)+((((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth))/(2*tub_wallgroovewidth)))));
}
}
//4
rotate([0,0,270])
{
translate([-tub_wall-tub_outsidewall-((((tub_length+tub_wall)*tubs_columns)+tub_wall)-(tub_wall*2))+(tub_wallgroovecorners/2),(tub_wall-tub_outsidewall),0])
{
if(grooves_yn==1)grooves(tub_wallgroovedepth,tub_wallgroovewidth,((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall-tub_wallgroovecorners,height,0);
}
}

////end grooves
} //end difference
//begin eyelets
//1 rowside
translate([(tub_wall-tub_outsidewall),(tub_wall-tub_outsidewall)-eyelets_walltoceneter,height-eyelets_belowtop])
{
for (e = [1:eyelets_rowside])
{
translate([(((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)/(eyelets_rowside+1)*e,0,0])
{
rotate([0,0,180])
{
eyelet(eyelets_od,eyelets_id,eyelets_width,tub_wallgroovedepth+eyelets_walltoceneter-(eyelets_od/2));
}
}
}
}
//2
//3
translate([(tub_wall-tub_outsidewall),((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2),height-eyelets_belowtop])
{
for (e = [1:eyelets_rowside])
{
translate([(((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)/(eyelets_rowside+1)*e,0,0])
{
rotate([0,0,0])
{
#eyelet(eyelets_od,eyelets_id,eyelets_width,tub_wallgroovedepth+eyelets_walltoceneter-(eyelets_od/2));
}
}
}
}
//4

//end eyelets
} //end union



//////end render
//////begin modules

////tub module
module tub()
{
union()
{
//walls
 difference()
  {
   cube(size = [tub_width+(tub_wall*2), tub_length+(tub_wall*2), height], center=false);
   translate([tub_wall,tub_wall,basethickness])
    {
     cube(size = [tub_width, tub_length, height-basethickness+1], center=false);
    }
  }
//end walls

//spheres lock ins
//1
      translate([tub_wall,(tub_length*1/4)+tub_wall,height-(((tub_lid_depthinto-tub_divot_height)/2)+(tub_divot_height/2))])
       {
        mirror([1,0,0])
         {
          #divot_sphere();
         }
       }
//2
      translate([tub_wall,(tub_length*3/4)+tub_wall,height-(((tub_lid_depthinto-tub_divot_height)/2)+(tub_divot_height/2))])
       {
        mirror([1,0,0])
         {
          divot_sphere();
         }
       }
//3
      translate([tub_width+tub_wall,(tub_length*1/4)+tub_wall,height-(((tub_lid_depthinto-tub_divot_height)/2)+(tub_divot_height/2))])
       {
        mirror([0,0,0])
         {
          divot_sphere();
         }
       }
//4
      translate([tub_width+tub_wall,(tub_length*3/4)+tub_wall,height-(((tub_lid_depthinto-tub_divot_height)/2)+(tub_divot_height/2))])
       {
        mirror([0,0,0])
         {
          divot_sphere();
         }
       }
//5
      translate([(tub_width*1/2)+tub_wall,tub_wall,height-(((tub_lid_depthinto-tub_divot_height)/2)+(tub_divot_height/2))])
       {
        mirror([0,1,0])
         {
          rotate([0,0,90])
           {
            #divot_sphere();
           }
         }
       }
//6
      translate([(tub_width*1/2)+tub_wall,tub_length+tub_wall,height-(((tub_lid_depthinto-tub_divot_height)/2)+(tub_divot_height/2))])
       {
        mirror([0,0,0])
         {
          rotate([0,0,90])
           {
            #divot_sphere();
           }
         }
       }
//end spheres

//begin locks

translate([(spacing/4)+(tub_width*1/4)+tub_wall,tub_length+tub_wall,basethickness+spacing+(((tub_width-(spacing*3))/2)/2)])
{
#slidelock(spacing);
}

translate([(-spacing/4)+(tub_width*3/4)+tub_wall,tub_length+tub_wall,basethickness+spacing+(((tub_width-(spacing*3))/2)/2)])
{
#slidelock(spacing);
}

translate([(spacing/4)+(tub_width*1/4)+tub_wall,tub_wall,basethickness+spacing+(((tub_width-(spacing*3))/2)/2)])
{
mirror([0,1,0])
{
#slidelock(spacing);
}
}

translate([(-spacing/4)+(tub_width*3/4)+tub_wall,tub_wall,basethickness+spacing+(((tub_width-(spacing*3))/2)/2)])
{
mirror([0,1,0])
{
#slidelock(spacing);
}
}

////upper lock rails



translate([(spacing/4)+(tub_width*1/4)+tub_wall,tub_length+tub_wall,cage_height+basethickness+spacing-(((tub_width-(spacing*3))/2)/2)])
{
#slidelockupper(spacing);
}

translate([(-spacing/4)+(tub_width*3/4)+tub_wall,tub_length+tub_wall,cage_height+basethickness+spacing-(((tub_width-(spacing*3))/2)/2)])
{
#slidelockupper(spacing);
}

translate([(spacing/4)+(tub_width*1/4)+tub_wall,tub_wall,cage_height+basethickness+spacing-(((tub_width-(spacing*3))/2)/2)])
{
mirror([0,1,0])
{
#slidelockupper(spacing);
}
}

translate([(-spacing/4)+(tub_width*3/4)+tub_wall,tub_wall,cage_height+basethickness+spacing-(((tub_width-(spacing*3))/2)/2)])
{
mirror([0,1,0])
{
#slidelockupper(spacing);
}
}



//end locks
}
}
////end tub module


//divider modules
module divider()
 {
  difference()
   {
    union()
     {
      cube(size=[spacing-1,spacing+cage_endwall+2,(spacing+cage_endwall+2)*2]);
      translate([0,0,(spacing+cage_endwall+2)*2])
       {
        rotate([0,45,0])
         {
          cube(size=[(sin(45)*(spacing-1)),spacing+cage_endwall+2,(sin(45)*(spacing-1))]);
         }
       }
     }
    translate([0,spacing+cage_endwall+2,-(((spacing+cage_endwall+2)/sin(45))/sin(45))/2])
     {
      rotate([45,0,0])
       {
        cube(size=[spacing-1,((spacing+cage_endwall+2)/sin(45)),((spacing+cage_endwall+2)/sin(45))]);       
       }
     }
   }
 }
//end divider module

//spacer module
module tub_spacer(length)
 {
translate([-(spacing-1),-length/2,0])
  {
  difference()
   {
    rotate([0,45,0])
     {
      cube(size = [((spacing-1)/sin(45)),length,((spacing-1)/sin(45))]);
     }
    translate([-(spacing-1)-0.1,0,-(spacing-1)])
     {
      #cube(size = [((spacing-1)/sin(45))/sin(45),length,((spacing-1)/sin(45))/sin(45)]);
     }
   }
 }
}
//end spacer

//divot
module divot_sphere()
{
difference()
{
translate([(tub_divot_height/2)/sin(45)*sin(45),0,0])
{
sphere(r = (tub_divot_height/2)/sin(45));
}
translate([(tub_divot_height/2)/sin(45),0,0])
cube(size = [((tub_divot_height/2)/sin(45)*2),((tub_divot_height/2)/sin(45)*2),((tub_divot_height/2)/sin(45)*2)], center=true);
}
}
//end divot module

////groove module

module grooves(tub_wallgroove,groove_width,groove_length,groove_height,groove_shift)
{
translate([((cos(45)*((groove_height/sin(45))+((groove_width*sin(45)*sin(45))/cos(45)))))-height/2,-.0001,height/2])
{
intersection()
{

intersection()
{
for(g = [(-(cos(45)*((groove_height/sin(45))+((groove_width*sin(45)*sin(45))/cos(45))))/groove_width/2) : (groove_length/groove_width/2)])
{
 translate([(g*groove_width*2)+(groove_width*sin(45)*sin(45)),0,groove_shift])
  {
  rotate([0,45,0])
   {
    rotate([0,0,45])
     {
      #cube(size = [groove_width*sin(45)*sin(45),groove_width*sin(45)*sin(45),((groove_height/sin(45))+((groove_width*sin(45)*sin(45))/cos(45)))+(abs(groove_shift/cos(45)*2))], center=true);
     }
   }
  }
}
translate([(-groove_height/2)-(groove_width*sin(45)*sin(45)),0,-groove_height/2])
{
#cube(size = [groove_length,tub_wallgroove,groove_height]);
}
}
translate([((-groove_height/2)-(groove_width*sin(45)*sin(45)))+(groove_length/2),0,0])
{
rotate([0,0,45])
{
cube(size = [groove_length*cos(45),groove_length*cos(45),groove_height],center=true);
}
}

 }//end intersection
}
}
////end groove mdoule

////begin eyelet module

module eyelet(od,id,eyelet_width,standoff)
{

translate([-eyelet_width/2,-(od/2)-standoff,-((od)+od)-standoff+(od/2)])//orgin set at the center of hole cylinder
{
difference()
   {
    union()
     {
      translate([0,standoff,standoff])
       {
        cube(size=[eyelet_width,od,(od/2)+od]);
       }
      translate([0,((od)/2)+standoff,((od/2)+od)+standoff])
       {
        rotate([0,90,0])
         {
          cylinder(r = od/2,h = eyelet_width, $fn=60);
         }
       }
      translate([0,0,0])
       {
        cube(size=[eyelet_width,(od/2)+standoff,((od)+od)+standoff]);
       } 
     }
    translate([-1,eyelet_width+2,-(((eyelet_width+2)/sin(45))/sin(45))/2])
     {
      rotate([45,0,0])
       {
        #cube(size=[eyelet_width+2,((od+standoff+2)/sin(45)),((eyelet_width+2)/sin(45))]);       
       }
     }
      translate([-1,((od)/2)+standoff,((od/2)+od)+standoff])
       {
        rotate([0,90,0])
         {
          cylinder(r = id/2,h = eyelet_width+2, $fn=60);
         }
       }

   }
  }
}

////end eyelet module

////calculations

echo("space above cages for extra fluid is", height-basethickness-spacing-cage_height-tub_lid_depthinto);


echo("tub print area x",((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall);

echo("tub print area y",((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall);

echo("tub print area z",height);

echo("cage cavity y",((tub_width-(spacing*3))/2)-(cage_wall*2));

echo("cage cavity x",(tub_length-(spacing*2))-(cage_endwall*2));

echo("cage cavity z",cage_height-cage_base);

echo("powder volume per cage",((((tub_width-(spacing*3))/2)-(cage_wall*2)))/10*(((tub_length-(spacing*2))-(cage_endwall*2)))/10*(cage_height-cage_base-cage_lid_depthinto)/10,"cm3");

echo("grams nickle hydroxide per cage",(((((tub_width-(spacing*3))/2)-(cage_wall*2)))/10*(((tub_length-(spacing*2))-(cage_endwall*2)))/10*(cage_height-cage_base-cage_lid_depthinto)/10)*(4.10),"grams");//density is 4.10

echo("total grams nickle hydroxide",(((((tub_width-(spacing*3))/2)-(cage_wall*2)))/10*(((tub_length-(spacing*2))-(cage_endwall*2)))/10*(cage_height-cage_base-cage_lid_depthinto)/10)*(4.10)*(tubs_columns*tubs_rows),"grams");

echo(((((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/tub_wallgroovewidth)-floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/tub_wallgroovewidth))*tub_wallgroovewidth)+tub_wallgroovewidth));

//2
echo((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth);

//3
echo((((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth);

//2+3
echo(((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth)+((((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth));

//(2+3)/absfloor
echo((2*tub_wallgroovewidth)*floor(((((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth)+((((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth))/(2*tub_wallgroovewidth))));

//3
echo((((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth)+((((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth))-((2*tub_wallgroovewidth)*floor(((((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth)+((((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth))/(2*tub_wallgroovewidth)))));




//slidelocking module
module slidelock(spacing)
{
 difference()
  {
   translate([0,-spacing,0]) //translate all
    {

//left
     translate([-(spacing/(1-cos(45)))*cos(45),0,-(spacing/(1-cos(45)))*cos(45)])
      {
       rotate([0,0,45])
        {
         cube(size = [(spacing/sin(45)),(spacing/sin(45)),((spacing/(1-cos(45)))*cos(45)*2)+spacing*2]);
        }//end rotate left
      }//end translate left

//right
      translate([(spacing/(1-cos(45)))*cos(45),0,-(spacing/(1-cos(45)))*cos(45)])
       {
        rotate([0,0,45])
         {
          cube(size = [(spacing/sin(45)),(spacing/sin(45)),((spacing/(1-cos(45)))*cos(45)*2)+spacing*2]);
         }//end rotate right
       }//end translate right
//bottom
       translate([(-(spacing/(1-cos(45)))*cos(45))-spacing,0,-(spacing/(1-cos(45)))*cos(45)])
        {
         rotate([90,45,90])
          {
           cube(size = [(spacing/sin(45)),(spacing/sin(45)),((spacing/(1-cos(45)))*cos(45)*2)+spacing*2]);
          }//end rotate bottom
        }//end translate bottom
//bump
        translate([(-(spacing/(1-cos(45)))*cos(45))-spacing,spacing*(2/5),((spacing/(1-cos(45)))*cos(45))-spacing*(2/5)])//set bump fraction
         {
          rotate([90,45,90])
           {
            cube(size = [(spacing/sin(45)),(spacing/sin(45)),((spacing/(1-cos(45)))*cos(45)*2)+spacing*2]);
           }//end rotate bump
         }//end translate bump
       
     }//end translate all

//trim left
translate([(-(spacing/(1-cos(45)))*cos(45))-spacing,-spacing*2,(-(spacing/(1-cos(45)))*cos(45))-spacing-1])
{
rotate([0,0,45])
{
cube(size = [(spacing/sin(45)),(spacing/sin(45)),((spacing/(1-cos(45)))*cos(45)*2)+(spacing*2)+spacing+2]);
}//end rotate left
}//end translate left

//trim right
translate([((spacing/(1-cos(45)))*cos(45))+spacing,-spacing*2,(-(spacing/(1-cos(45)))*cos(45))-spacing-1])
{
rotate([0,0,45])
{
cube(size = [(spacing/sin(45)),(spacing/sin(45)),((spacing/(1-cos(45)))*cos(45)*2)+(spacing*2)+spacing+2]);
}//end rotate right
}//end translate right

//trim back
translate([0,((spacing/(1-cos(45)))*2)/2,spacing/2])
{
cube(size = [((spacing/(1-cos(45)))*2)+1,((spacing/(1-cos(45)))*2),((spacing/(1-cos(45)))*2)+spacing+1], center=true);
}

}//end difference
}///end slidelocking module

//slidelocking module
module slidelockupper(spacing)
{
 difference()
  {
   translate([0,-spacing,0]) //translate all
    {
//left
     translate([-(spacing/(1-cos(45)))*cos(45),0,-(spacing/(1-cos(45)))*cos(45)])
      {
       rotate([0,0,45])
        {
         cube(size = [(spacing/sin(45)),(spacing/sin(45)),((spacing/(1-cos(45)))*cos(45)*2)+spacing*2]);
        }//end rotate left
      }//end translate left
//right
     translate([(spacing/(1-cos(45)))*cos(45),0,-(spacing/(1-cos(45)))*cos(45)])
      {
       rotate([0,0,45])
        {
         cube(size = [(spacing/sin(45)),(spacing/sin(45)),((spacing/(1-cos(45)))*cos(45)*2)+spacing*2]);
        }//end rotate right
      }//end translate right
    }//end translate all
//trim left
   translate([(-(spacing/(1-cos(45)))*cos(45))-spacing,-spacing*2,(-(spacing/(1-cos(45)))*cos(45))-spacing-1])
    {
     rotate([0,0,45])
      {
       cube(size = [(spacing/sin(45)),(spacing/sin(45)),((spacing/(1-cos(45)))*cos(45)*2)+(spacing*2)+spacing+2]);
      }//end rotate left
    }//end translate left
//trim right
   translate([((spacing/(1-cos(45)))*cos(45))+spacing,-spacing*2,(-(spacing/(1-cos(45)))*cos(45))-spacing-1])
    {
     rotate([0,0,45])
      {
       cube(size = [(spacing/sin(45)),(spacing/sin(45)),((spacing/(1-cos(45)))*cos(45)*2)+(spacing*2)+spacing+2]);
      }//end rotate right
    }//end translate right
//trim back
   translate([0,((spacing/(1-cos(45)))*2)/2,spacing/2])
    {
     cube(size = [((spacing/(1-cos(45)))*2)+1,((spacing/(1-cos(45)))*2),((spacing/(1-cos(45)))*2)+spacing+1], center=true);
    }
  }//end difference
}///end slidelocking module


//divot by depth module
module divot_sphere_d()
 {
  translate([0,0,0])
   {
    difference()
     {
      translate([(spacing/(1-cos(45)))*sin(45),0,0])
       {
        sphere(r = (spacing/(1-cos(45))));
       }
      translate([(spacing/(1-cos(45))),0,0])
       {
        cube(size = [((spacing/(1-cos(45)))*2),((spacing/(1-cos(45)))*2),((spacing/(1-cos(45)))*2)], center=true);
       }       
     }
   }
 }
//end divot module


//divot by height
module divot_sphere()
{
difference()
{
translate([(tub_divot_height/2)/sin(45)*sin(45),0,0])
{
sphere(r = (tub_divot_height/2)/sin(45));
}
translate([(tub_divot_height/2)/sin(45),0,0])
cube(size = [((tub_divot_height/2)/sin(45)*2),((tub_divot_height/2)/sin(45)*2),((tub_divot_height/2)/sin(45)*2)], center=true);
}
}
//end divot
 

target width to actual width

chooses a width that allows for the grooves to align

still need to integrate into tub scad

tub_wallgroovewidthactual=((2*(tub_width+(2*tub_outsidewall)-tub_wallgroovecorners))+(2*(tub_length+(2*tub_outsidewall)-tub_wallgroovecorners)))/(2*round(((2*(tub_width+(2*tub_outsidewall)-tub_wallgroovecorners))+(2*(tub_length+(2*tub_outsidewall)-tub_wallgroovecorners)))/(2*tub_wallgroovewidth)));

echo("groove width=",tub_wallgroovewidthactual);
 

rounded corners

updated 20151001


  • grooves messed up :(
height = 160;
tub_width = 38;
tub_length = 88;
basethickness = 5;
tub_wall = 2;
tub_outsidewall = 4;
tub_wallgroovedepth = 2;
tub_wallgroovewidth = 15;
tub_wallgroovecorners =08;
tub_wallgrooveshift = 0; //-0.5 1st try, messes up groove matchup
grooves_yn = 1; //1 yes 0 no

eyelets_rowside = 2;
eyelets_columnside = 3;

eyelets_belowtop = 10;
eyelets_walltoceneter = 5;
eyelets_od = 7;
eyelets_id = 3;
eyelets_width = 5;

tubs_rows    = 1;
tubs_columns = 1;

spacing = 1.940055;
wall_spacers_yn = 0; //1 yes 0 no
center_dividers = 0; //1 yes 0 no
cage_height = 120;
cage_wall = 7;
cage_endwall = 2;
cage_base = 4;

mesh_opening = 1.875 ;
mesh_angle = 50;
mesh_spacing = 4.1;

wire_diameter = 2;
wire_holeoffc = 0;
cage_lid_depthinto = 7;
cage_divot_height = 5.5;
tub_lid_depthinto = 7;
tub_divot_height = 5.5;

//*******************************************

tub_wallgroovewidthactual=((2*(tub_width+(2*tub_outsidewall)-tub_wallgroovecorners))+(2*(tub_length+(2*tub_outsidewall)-tub_wallgroovecorners)))/(2*round(((2*(tub_width+(2*tub_outsidewall)-tub_wallgroovecorners))+(2*(tub_length+(2*tub_outsidewall)-tub_wallgroovecorners)))/(2*tub_wallgroovewidth)));


echo("groove width=",tub_wallgroovewidthactual);

echo(tan(45)*(tub_width+(2*tub_outsidewall)-tub_wallgroovecorners)
-(floor((tub_width+(2*tub_outsidewall)-tub_wallgroovecorners)/tub_wallgroovewidthactual)*tub_wallgroovewidthactual));

echo((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth);

echo((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidthactual*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidthactual))))-tub_wallgroovewidthactual);

echo((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners);

echo((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/tub_wallgroovewidthactual)*tub_wallgroovewidthactual)));

echo(((((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidthactual*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidthactual))))-tub_wallgroovewidthactual)+((((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidthactual*floor(((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidthactual))))-tub_wallgroovewidthactual))-((2*tub_wallgroovewidthactual)*floor(((((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidthactual*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidthactual))))-tub_wallgroovewidthactual)+((((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidthactual*floor(((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidthactual))))-tub_wallgroovewidthactual))/(2*tub_wallgroovewidthactual))))));

echo(((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidthactual*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidthactual))))-tub_wallgroovewidthactual))
;



union()//eyelets
{
difference()//grooves
{
union()
 {

//tubs
for (c = [0 : tubs_columns-1])
 {
  translate([0,c*(tub_length+tub_wall),0])
   {
    for (r = [0 : tubs_rows-1])
    {
     translate([r*(tub_width+tub_wall),0,0])
      {
       tub();
      }
    }
   }
 }
//end tubs

//outer walls
translate([-tub_outsidewall+tub_wall+(tub_wallgroovecorners/2),-tub_outsidewall+tub_wall+(tub_wallgroovecorners/2),0])
 {
  difference()
   {
       $fn=50;
       minkowski()
       {
    cube(size = [(((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners,(((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners,height-1]);
    cylinder(r=(tub_wallgroovecorners/2),h=(1));
   }
       
    translate([tub_outsidewall-(tub_wallgroovecorners/2),tub_outsidewall-(tub_wallgroovecorners/2),0])
     {
      cube(size = [(((tub_width+tub_wall)*tubs_rows)+tub_wall)-(tub_wall*2),(((tub_length+tub_wall)*tubs_columns)+tub_wall)-(tub_wall*2),height+1]);
     }
   }
 }

//end outer walls

} //end union

////grooves
//1
rotate([0,0,0])
{
translate([tub_wall-tub_outsidewall+(tub_wallgroovecorners/2),tub_wall-tub_outsidewall,0])
{
if(grooves_yn==1)grooves(tub_wallgroovedepth,tub_wallgroovewidthactual,(((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners,height,0);
}
}
//2
rotate([0,0,90])
{
translate([(tub_wall-tub_outsidewall)+(tub_wallgroovecorners/2),-(tub_wall-tub_outsidewall)-(((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall),0])
{
if(grooves_yn==1)grooves(tub_wallgroovedepth,tub_wallgroovewidthactual,((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall-tub_wallgroovecorners,height,(((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidthactual*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidthactual))))-tub_wallgroovewidthactual))-(tub_wallgrooveshift*1));
}
}
//3
rotate([0,0,180])
{
translate([-(tub_wall-tub_outsidewall)-(tub_wallgroovecorners/2)-((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners),-tub_wall-tub_outsidewall-((((tub_length+tub_wall)*tubs_columns)+tub_wall)-(tub_wall*2)),0])
{
if(grooves_yn==1)grooves(tub_wallgroovedepth,tub_wallgroovewidthactual,(((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners,height,((((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidthactual*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidthactual))))-tub_wallgroovewidthactual)+((((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidthactual*floor(((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidthactual))))-tub_wallgroovewidthactual))-((2*tub_wallgroovewidthactual)*floor(((((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidthactual*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidthactual))))-tub_wallgroovewidthactual)+((((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidthactual*floor(((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidthactual))))-tub_wallgroovewidthactual))/(2*tub_wallgroovewidthactual)))))-(tub_wallgrooveshift*2));
}
}
//4
rotate([0,0,270])
{
translate([-tub_wall-tub_outsidewall-((((tub_length+tub_wall)*tubs_columns)+tub_wall)-(tub_wall*2))+(tub_wallgroovecorners/2),(tub_wall-tub_outsidewall),0])
{
if(grooves_yn==1)grooves(tub_wallgroovedepth,tub_wallgroovewidth,((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall-tub_wallgroovecorners,height,((((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-
(2*tub_wallgroovewidthactual*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-
tub_wallgroovecorners)/(2*tub_wallgroovewidthactual))))-tub_wallgroovewidthactual)
+
((((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-
(2*tub_wallgroovewidthactual*floor(((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-
tub_wallgroovecorners)/(2*tub_wallgroovewidthactual))))-tub_wallgroovewidthactual)
+
((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-
(2*tub_wallgroovewidthactual*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-
tub_wallgroovecorners)/(2*tub_wallgroovewidthactual))))-tub_wallgroovewidthactual))
-
((2*tub_wallgroovewidthactual)
*
floor(((((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-
(2*tub_wallgroovewidthactual*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-
tub_wallgroovecorners)/(2*tub_wallgroovewidthactual))))-tub_wallgroovewidthactual)
+
((((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-
(2*tub_wallgroovewidthactual*floor(((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-
tub_wallgroovecorners)/(2*tub_wallgroovewidthactual))))-tub_wallgroovewidthactual)
+
((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-
(2*tub_wallgroovewidthactual*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-
tub_wallgroovecorners)/(2*tub_wallgroovewidthactual))))-tub_wallgroovewidthactual))
/
(2*tub_wallgroovewidthactual)))))-(tub_wallgrooveshift*3));
}
}

////end grooves
} //end difference
//begin eyelets
//1 rowside
translate([(tub_wall-tub_outsidewall),(tub_wall-tub_outsidewall)-eyelets_walltoceneter,height-eyelets_belowtop])
{
for (e = [1:eyelets_rowside])
{
translate([(((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)/(eyelets_rowside+1)*e,0,0])
{
rotate([0,0,180])
{
eyelet(eyelets_od,eyelets_id,eyelets_width,tub_wallgroovedepth+eyelets_walltoceneter-(eyelets_od/2));
}
}
}
}
//2
//3
translate([(tub_wall-tub_outsidewall),((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2),height-eyelets_belowtop])
{
for (e = [1:eyelets_rowside])
{
translate([(((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)/(eyelets_rowside+1)*e,0,0])
{
rotate([0,0,0])
{
#eyelet(eyelets_od,eyelets_id,eyelets_width,tub_wallgroovedepth+eyelets_walltoceneter-(eyelets_od/2));
}
}
}
}
//4

//end eyelets
} //end union



//////end render
//////begin modules

////tub module
module tub()
{
union()
{
//walls
 difference()
  {
   cube(size = [tub_width+(tub_wall*2), tub_length+(tub_wall*2), height], center=false);
   translate([tub_wall+spacing,tub_wall+spacing,basethickness])
    {
        $fn=50;
      minkowski()
        {
       cube(size = [tub_width-(spacing*2), tub_length-(spacing*2), height-basethickness+1-1], center=false);
        cylinder(r=spacing,h=1);
      }
    }
  }
//end walls

//spheres lock ins
//1
      translate([tub_wall,(tub_length*1/4)+tub_wall,height-(((tub_lid_depthinto-tub_divot_height)/2)+(tub_divot_height/2))])
       {
        mirror([1,0,0])
         {
          #divot_sphere();
         }
       }
//2
      translate([tub_wall,(tub_length*3/4)+tub_wall,height-(((tub_lid_depthinto-tub_divot_height)/2)+(tub_divot_height/2))])
       {
        mirror([1,0,0])
         {
          divot_sphere();
         }
       }
//3
      translate([tub_width+tub_wall,(tub_length*1/4)+tub_wall,height-(((tub_lid_depthinto-tub_divot_height)/2)+(tub_divot_height/2))])
       {
        mirror([0,0,0])
         {
          divot_sphere();
         }
       }
//4
      translate([tub_width+tub_wall,(tub_length*3/4)+tub_wall,height-(((tub_lid_depthinto-tub_divot_height)/2)+(tub_divot_height/2))])
       {
        mirror([0,0,0])
         {
          divot_sphere();
         }
       }
//5
      translate([(tub_width*1/2)+tub_wall,tub_wall,height-(((tub_lid_depthinto-tub_divot_height)/2)+(tub_divot_height/2))])
       {
        mirror([0,1,0])
         {
          rotate([0,0,90])
           {
            #divot_sphere();
           }
         }
       }
//6
      translate([(tub_width*1/2)+tub_wall,tub_length+tub_wall,height-(((tub_lid_depthinto-tub_divot_height)/2)+(tub_divot_height/2))])
       {
        mirror([0,0,0])
         {
          rotate([0,0,90])
           {
            #divot_sphere();
           }
         }
       }
//end spheres

//begin locks

translate([(spacing/4)+(tub_width*1/4)+tub_wall,tub_length+tub_wall,basethickness+spacing+(((tub_width-(spacing*3))/2)/2)])
{
#slidelock(spacing);
}

translate([(-spacing/4)+(tub_width*3/4)+tub_wall,tub_length+tub_wall,basethickness+spacing+(((tub_width-(spacing*3))/2)/2)])
{
#slidelock(spacing);
}

translate([(spacing/4)+(tub_width*1/4)+tub_wall,tub_wall,basethickness+spacing+(((tub_width-(spacing*3))/2)/2)])
{
mirror([0,1,0])
{
#slidelock(spacing);
}
}

translate([(-spacing/4)+(tub_width*3/4)+tub_wall,tub_wall,basethickness+spacing+(((tub_width-(spacing*3))/2)/2)])
{
mirror([0,1,0])
{
#slidelock(spacing);
}
}

////upper lock rails



translate([(spacing/4)+(tub_width*1/4)+tub_wall,tub_length+tub_wall,cage_height+basethickness+spacing-(((tub_width-(spacing*3))/2)/2)])
{
#slidelockupper(spacing);
}

translate([(-spacing/4)+(tub_width*3/4)+tub_wall,tub_length+tub_wall,cage_height+basethickness+spacing-(((tub_width-(spacing*3))/2)/2)])
{
#slidelockupper(spacing);
}

translate([(spacing/4)+(tub_width*1/4)+tub_wall,tub_wall,cage_height+basethickness+spacing-(((tub_width-(spacing*3))/2)/2)])
{
mirror([0,1,0])
{
#slidelockupper(spacing);
}
}

translate([(-spacing/4)+(tub_width*3/4)+tub_wall,tub_wall,cage_height+basethickness+spacing-(((tub_width-(spacing*3))/2)/2)])
{
mirror([0,1,0])
{
#slidelockupper(spacing);
}
}



//end locks
}
}
////end tub module


//divider modules
module divider()
 {
  difference()
   {
    union()
     {
      cube(size=[spacing-1,spacing+cage_endwall+2,(spacing+cage_endwall+2)*2]);
      translate([0,0,(spacing+cage_endwall+2)*2])
       {
        rotate([0,45,0])
         {
          cube(size=[(sin(45)*(spacing-1)),spacing+cage_endwall+2,(sin(45)*(spacing-1))]);
         }
       }
     }
    translate([0,spacing+cage_endwall+2,-(((spacing+cage_endwall+2)/sin(45))/sin(45))/2])
     {
      rotate([45,0,0])
       {
        cube(size=[spacing-1,((spacing+cage_endwall+2)/sin(45)),((spacing+cage_endwall+2)/sin(45))]);       
       }
     }
   }
 }
//end divider module

//spacer module
module tub_spacer(length)
 {
translate([-(spacing-1),-length/2,0])
  {
  difference()
   {
    rotate([0,45,0])
     {
      cube(size = [((spacing-1)/sin(45)),length,((spacing-1)/sin(45))]);
     }
    translate([-(spacing-1)-0.1,0,-(spacing-1)])
     {
      #cube(size = [((spacing-1)/sin(45))/sin(45),length,((spacing-1)/sin(45))/sin(45)]);
     }
   }
 }
}
//end spacer

//divot
module divot_sphere()
{
difference()
{
translate([(tub_divot_height/2)/sin(45)*sin(45),0,0])
{
sphere(r = (tub_divot_height/2)/sin(45));
}
translate([(tub_divot_height/2)/sin(45),0,0])
cube(size = [((tub_divot_height/2)/sin(45)*2),((tub_divot_height/2)/sin(45)*2),((tub_divot_height/2)/sin(45)*2)], center=true);
}
}
//end divot module

////groove module

module grooves(tub_wallgroove,groove_width,groove_length,groove_height,groove_shift)
{
translate([((cos(45)*((groove_height/sin(45))+((groove_width*sin(45)*sin(45))/cos(45)))))-height/2,-.0001,height/2])
{
intersection()
{

intersection()
{
for(g = [(-(cos(45)*((groove_height/sin(45))+((groove_width*sin(45)*sin(45))/cos(45))))/groove_width/2) : (groove_length/groove_width/2)])
{
 translate([(g*groove_width*2)+(groove_width*sin(45)*sin(45)),0,groove_shift])
  {
  rotate([0,45,0])
   {
    rotate([0,0,45])
     {
      #cube(size = [groove_width*sin(45)*sin(45),groove_width*sin(45)*sin(45),((groove_height/sin(45))+((groove_width*sin(45)*sin(45))/cos(45)))+(abs(groove_shift/cos(45)*2))], center=true);
     }
   }
  }
}
translate([(-groove_height/2)-(groove_width*sin(45)*sin(45)),0,-groove_height/2])
{
#cube(size = [groove_length,tub_wallgroove,groove_height]);
}
}
translate([((-groove_height/2)-(groove_width*sin(45)*sin(45)))+(groove_length/2),0,0])
{
rotate([0,0,45])
{
cube(size = [groove_length*cos(45),groove_length*cos(45),groove_height],center=true);
}
}

 }//end intersection
}
}
////end groove mdoule

////begin eyelet module

module eyelet(od,id,eyelet_width,standoff)
{

translate([-eyelet_width/2,-(od/2)-standoff,-((od)+od)-standoff+(od/2)])//orgin set at the center of hole cylinder
{
difference()
   {
    union()
     {
      translate([0,standoff,standoff])
       {
        cube(size=[eyelet_width,od,(od/2)+od]);
       }
      translate([0,((od)/2)+standoff,((od/2)+od)+standoff])
       {
        rotate([0,90,0])
         {
          cylinder(r = od/2,h = eyelet_width, $fn=60);
         }
       }
      translate([0,0,0])
       {
        cube(size=[eyelet_width,(od/2)+standoff,((od)+od)+standoff]);
       } 
     }
    translate([-1,eyelet_width+2,-(((eyelet_width+2)/sin(45))/sin(45))/2])
     {
      rotate([45,0,0])
       {
        #cube(size=[eyelet_width+2,((od+standoff+2)/sin(45)),((eyelet_width+2)/sin(45))]);       
       }
     }
      translate([-1,((od)/2)+standoff,((od/2)+od)+standoff])
       {
        rotate([0,90,0])
         {
          cylinder(r = id/2,h = eyelet_width+2, $fn=60);
         }
       }

   }
  }
}

////end eyelet module

////calculations

echo("space above cages for extra fluid is", height-basethickness-spacing-cage_height-tub_lid_depthinto);


echo("tub print area x",((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall);

echo("tub print area y",((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall);

echo("tub print area z",height);

echo("cage cavity y",((tub_width-(spacing*3))/2)-(cage_wall*2));

echo("cage cavity x",(tub_length-(spacing*2))-(cage_endwall*2));

echo("cage cavity z",cage_height-cage_base);

echo("powder volume per cage",((((tub_width-(spacing*3))/2)-(cage_wall*2)))/10*(((tub_length-(spacing*2))-(cage_endwall*2)))/10*(cage_height-cage_base-cage_lid_depthinto)/10,"cm3");

echo("grams nickle hydroxide per cage",(((((tub_width-(spacing*3))/2)-(cage_wall*2)))/10*(((tub_length-(spacing*2))-(cage_endwall*2)))/10*(cage_height-cage_base-cage_lid_depthinto)/10)*(4.10),"grams");//density is 4.10

echo("total grams nickle hydroxide",(((((tub_width-(spacing*3))/2)-(cage_wall*2)))/10*(((tub_length-(spacing*2))-(cage_endwall*2)))/10*(cage_height-cage_base-cage_lid_depthinto)/10)*(4.10)*(tubs_columns*tubs_rows),"grams");

echo(((((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/tub_wallgroovewidth)-floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/tub_wallgroovewidth))*tub_wallgroovewidth)+tub_wallgroovewidth));

//2
echo((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth);

//3
echo((((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth);

//2+3
echo(((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth)+((((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth));

//(2+3)/absfloor
echo((2*tub_wallgroovewidth)*floor(((((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth)+((((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth))/(2*tub_wallgroovewidth))));

//3
echo((((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth)+((((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth))-((2*tub_wallgroovewidth)*floor(((((((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_width+tub_wall)*tubs_rows)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth)+((((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)-(2*tub_wallgroovewidth*floor(((((tub_length+tub_wall)*tubs_columns)+(tub_outsidewall*2)-tub_wall)-tub_wallgroovecorners)/(2*tub_wallgroovewidth))))-tub_wallgroovewidth))/(2*tub_wallgroovewidth)))));




//slidelocking module
module slidelock(spacing)
{
 difference()
  {
   translate([0,-spacing,0]) //translate all
    {

//left
     translate([-(spacing/(1-cos(45)))*cos(45),0,-(spacing/(1-cos(45)))*cos(45)])
      {
       rotate([0,0,45])
        {
         cube(size = [(spacing/sin(45)),(spacing/sin(45)),((spacing/(1-cos(45)))*cos(45)*2)+spacing*2]);
        }//end rotate left
      }//end translate left

//right
      translate([(spacing/(1-cos(45)))*cos(45),0,-(spacing/(1-cos(45)))*cos(45)])
       {
        rotate([0,0,45])
         {
          cube(size = [(spacing/sin(45)),(spacing/sin(45)),((spacing/(1-cos(45)))*cos(45)*2)+spacing*2]);
         }//end rotate right
       }//end translate right
//bottom
       translate([(-(spacing/(1-cos(45)))*cos(45))-spacing,0,-(spacing/(1-cos(45)))*cos(45)])
        {
         rotate([90,45,90])
          {
           cube(size = [(spacing/sin(45)),(spacing/sin(45)),((spacing/(1-cos(45)))*cos(45)*2)+spacing*2]);
          }//end rotate bottom
        }//end translate bottom
//bump
        translate([(-(spacing/(1-cos(45)))*cos(45))-spacing,spacing*(2/5),((spacing/(1-cos(45)))*cos(45))-spacing*(2/5)])//set bump fraction
         {
          rotate([90,45,90])
           {
            cube(size = [(spacing/sin(45)),(spacing/sin(45)),((spacing/(1-cos(45)))*cos(45)*2)+spacing*2]);
           }//end rotate bump
         }//end translate bump
       
     }//end translate all

//trim left
translate([(-(spacing/(1-cos(45)))*cos(45))-spacing,-spacing*2,(-(spacing/(1-cos(45)))*cos(45))-spacing-1])
{
rotate([0,0,45])
{
cube(size = [(spacing/sin(45)),(spacing/sin(45)),((spacing/(1-cos(45)))*cos(45)*2)+(spacing*2)+spacing+2]);
}//end rotate left
}//end translate left

//trim right
translate([((spacing/(1-cos(45)))*cos(45))+spacing,-spacing*2,(-(spacing/(1-cos(45)))*cos(45))-spacing-1])
{
rotate([0,0,45])
{
cube(size = [(spacing/sin(45)),(spacing/sin(45)),((spacing/(1-cos(45)))*cos(45)*2)+(spacing*2)+spacing+2]);
}//end rotate right
}//end translate right

//trim back
translate([0,((spacing/(1-cos(45)))*2)/2,spacing/2])
{
cube(size = [((spacing/(1-cos(45)))*2)+1,((spacing/(1-cos(45)))*2),((spacing/(1-cos(45)))*2)+spacing+1], center=true);
}

}//end difference
}///end slidelocking module

//slidelocking module
module slidelockupper(spacing)
{
 difference()
  {
   translate([0,-spacing,0]) //translate all
    {
//left
     translate([-(spacing/(1-cos(45)))*cos(45),0,-(spacing/(1-cos(45)))*cos(45)])
      {
       rotate([0,0,45])
        {
         cube(size = [(spacing/sin(45)),(spacing/sin(45)),((spacing/(1-cos(45)))*cos(45)*2)+spacing*2]);
        }//end rotate left
      }//end translate left
//right
     translate([(spacing/(1-cos(45)))*cos(45),0,-(spacing/(1-cos(45)))*cos(45)])
      {
       rotate([0,0,45])
        {
         cube(size = [(spacing/sin(45)),(spacing/sin(45)),((spacing/(1-cos(45)))*cos(45)*2)+spacing*2]);
        }//end rotate right
      }//end translate right
    }//end translate all
//trim left
   translate([(-(spacing/(1-cos(45)))*cos(45))-spacing,-spacing*2,(-(spacing/(1-cos(45)))*cos(45))-spacing-1])
    {
     rotate([0,0,45])
      {
       cube(size = [(spacing/sin(45)),(spacing/sin(45)),((spacing/(1-cos(45)))*cos(45)*2)+(spacing*2)+spacing+2]);
      }//end rotate left
    }//end translate left
//trim right
   translate([((spacing/(1-cos(45)))*cos(45))+spacing,-spacing*2,(-(spacing/(1-cos(45)))*cos(45))-spacing-1])
    {
     rotate([0,0,45])
      {
       cube(size = [(spacing/sin(45)),(spacing/sin(45)),((spacing/(1-cos(45)))*cos(45)*2)+(spacing*2)+spacing+2]);
      }//end rotate right
    }//end translate right
//trim back
   translate([0,((spacing/(1-cos(45)))*2)/2,spacing/2])
    {
     cube(size = [((spacing/(1-cos(45)))*2)+1,((spacing/(1-cos(45)))*2),((spacing/(1-cos(45)))*2)+spacing+1], center=true);
//trim bottom
       translate([0,(-((spacing/(1-cos(45)))*2)/2)-spacing,(-(spacing/(1-cos(45)))*cos(45))-1])
        {
         rotate([90,45,90])
          {
           #cube(size = [(spacing/sin(45)),(spacing/sin(45)),((spacing/(1-cos(45)))*cos(45)*2)+spacing*2],center=true);
          }//end rotate bottom
        }//end translate bottom
    }
  }//end difference
}///end slidelocking module


//divot by depth module
module divot_sphere_d()
 {
  translate([0,0,0])
   {
    difference()
     {
      translate([(spacing/(1-cos(45)))*sin(45),0,0])
       {
        sphere(r = (spacing/(1-cos(45))));
       }
      translate([(spacing/(1-cos(45))),0,0])
       {
        cube(size = [((spacing/(1-cos(45)))*2),((spacing/(1-cos(45)))*2),((spacing/(1-cos(45)))*2)], center=true);
       }       
     }
   }
 }
//end divot module


//divot by height
module divot_sphere()
{
difference()
{
translate([(tub_divot_height/2)/sin(45)*sin(45),0,0])
{
sphere(r = (tub_divot_height/2)/sin(45));
}
translate([(tub_divot_height/2)/sin(45),0,0])
cube(size = [((tub_divot_height/2)/sin(45)*2),((tub_divot_height/2)/sin(45)*2),((tub_divot_height/2)/sin(45)*2)], center=true);
}
}
//end divot

 

tub cells lid

tub main lid

eyelet module

module eyelet(od,id,width,standoff)
{

translate([-width/2,-(od/2)-standoff,-((od)+od)-standoff+(od/2)])//orgin set at the center of hole cylinder
{
difference()
   {
    union()
     {
      translate([0,standoff,standoff])
       {
        cube(size=[width,od,(od/2)+od]);
       }
      translate([0,((od)/2)+standoff,((od/2)+od)+standoff])
       {
        rotate([0,90,0])
         {
          cylinder(r = od/2,h = width, $fn=60);
         }
       }
      translate([0,0,0])
       {
        cube(size=[width,(od/2)+standoff,((od)+od)+standoff]);
       } 
     }
    translate([-1,width+2,-(((width+2)/sin(45))/sin(45))/2])
     {
      rotate([45,0,0])
       {
        #cube(size=[width+2,((od+standoff+2)/sin(45)),((width+2)/sin(45))]);       
       }
     }
      translate([-1,((od)/2)+standoff,((od/2)+od)+standoff])
       {
        rotate([0,90,0])
         {
          cylinder(r = id/2,h = width+2, $fn=60);
         }
       }

   }
  }
}

eyelet(5,2,2,5);


 

locks

slide divot lock

updated 20150113

spacing = 5;

slidelock(spacing);

module slidelock(spacing)
{

difference()
{

translate([0,-spacing,0]) //translate all
{

//left
translate([-(spacing/(1-cos(45)))*cos(45),0,-(spacing/(1-cos(45)))*cos(45)])
{
rotate([0,0,45])
{
cube(size = [(spacing/sin(45)),(spacing/sin(45)),((spacing/(1-cos(45)))*cos(45)*2)+spacing*2]);
}//end rotate left
}//end translate left

//right
translate([(spacing/(1-cos(45)))*cos(45),0,-(spacing/(1-cos(45)))*cos(45)])
{
rotate([0,0,45])
{
cube(size = [(spacing/sin(45)),(spacing/sin(45)),((spacing/(1-cos(45)))*cos(45)*2)+spacing*2]);
}//end rotate right
}//end translate right

//bottom
translate([(-(spacing/(1-cos(45)))*cos(45))-spacing,0,-(spacing/(1-cos(45)))*cos(45)])
{
rotate([90,45,90])
{
cube(size = [(spacing/sin(45)),(spacing/sin(45)),((spacing/(1-cos(45)))*cos(45)*2)+spacing*2]);
}//end rotate bottom
}//end translate bottom

//bump
translate([(-(spacing/(1-cos(45)))*cos(45))-spacing,spacing*(2/5),((spacing/(1-cos(45)))*cos(45))-spacing*(2/5)])//set bump fraction
{
rotate([90,45,90])
{
cube(size = [(spacing/sin(45)),(spacing/sin(45)),((spacing/(1-cos(45)))*cos(45)*2)+spacing*2]);
}//end rotate bump
}//end translate bump

}//end translate all

//trim left
translate([(-(spacing/(1-cos(45)))*cos(45))-spacing,-spacing*2,(-(spacing/(1-cos(45)))*cos(45))-spacing-1])
{
rotate([0,0,45])
{
#cube(size = [(spacing/sin(45)),(spacing/sin(45)),((spacing/(1-cos(45)))*cos(45)*2)+(spacing*2)+spacing+2]);
}//end rotate left
}//end translate left

//trim right
translate([((spacing/(1-cos(45)))*cos(45))+spacing,-spacing*2,(-(spacing/(1-cos(45)))*cos(45))-spacing-1])
{
rotate([0,0,45])
{
#cube(size = [(spacing/sin(45)),(spacing/sin(45)),((spacing/(1-cos(45)))*cos(45)*2)+(spacing*2)+spacing+2]);
}//end rotate right
}//end translate right

//trim back
translate([0,((spacing/(1-cos(45)))*2)/2,spacing/2])
{
#cube(size = [((spacing/(1-cos(45)))*2)+1,((spacing/(1-cos(45)))*2),((spacing/(1-cos(45)))*2)+spacing+1], center=true);
}

}//end difference


//divot by depth module
module divot_sphere(slider_divot_height)
translate([spacing,0,0])
{
{
difference()
{
translate([(spacing/(1-cos(45)))*sin(45),0,0])
{
#sphere(r = (spacing/(1-cos(45))));
}
translate([(spacing/(1-cos(45))),0,0])
#cube(size = [((spacing/(1-cos(45)))*2),((spacing/(1-cos(45)))*2),((spacing/(1-cos(45)))*2)], center=true);
}
}
}
//end divot module
}
 


sphere lock in divot

height = 60;
tub_width = 95;
tub_length = 70;
outsidewall = 5;
basethickness = 5;
tub_wall = 5;

spacing = 5;
cage_height = 40;
cage_wall = 7.5;
cage_endwall = 1;
cage_base = 5;
wedge_hieght = 10;

mesh_opening = 1 ;
mesh_angle = 35;
mesh_spacing = 2;

lock_radius = 5;
lock_depth = 1;
lock_distancefromcenter = 0;

module half()
 {
  difference()
  {
  union()
   {
//lock_sphere padding added to endwall
    difference()
     {
      translate([((tub_width-(spacing*3))/2)/2,lock_depth-lock_radius,(cage_height)/2])
       {
        sphere(lock_radius+cage_endwall);
       }
      translate([(((tub_width-(spacing*3))/2)/2)-(lock_radius+cage_endwall),-(((lock_radius+cage_endwall)*2)-(cage_endwall+lock_depth)),((cage_height)/2)-(lock_radius+cage_endwall)])
       {
        cube(size = [((lock_radius+cage_endwall)*2),((lock_radius+cage_endwall)*2)-lock_depth-cage_endwall,(lock_radius+cage_endwall)*2]);
       }
     }
    mirror([0,1,0])
     {
      translate([0,-(tub_length-(spacing*2)),0])
      {
    difference()
     {
      translate([((tub_width-(spacing*3))/2)/2,lock_depth-lock_radius,(cage_height)/2])
       {
        sphere(lock_radius+cage_endwall);
       }
      translate([(((tub_width-(spacing*3))/2)/2)-(lock_radius+cage_endwall),-(((lock_radius+cage_endwall)*2)-(cage_endwall+lock_depth)),((cage_height)/2)-(lock_radius+cage_endwall)])
       {
        cube(size = [((lock_radius+cage_endwall)*2),((lock_radius+cage_endwall)*2)-lock_depth-cage_endwall,(lock_radius+cage_endwall)*2]);
       }
     }
      }
     }
    difference()
	  {
		cube(size = [(tub_width-(spacing*3))/2,tub_length-(spacing*2),cage_height], center=false);
//delete half of it
		cube(size = [((tub_width-(spacing*3))/2)/2,(tub_length-(spacing*2)),cage_height], center=false);
		translate([cage_wall, cage_endwall, cage_base])
			cube(size = [((tub_width-(spacing*3))/2)-(cage_wall*2),(tub_length-(spacing*2))-(cage_endwall*2),cage_height-cage_base+1], center=false);
  translate([((tub_width-(spacing*3))/2)-cage_wall-((sin(mesh_angle)*sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/2), cage_endwall-(mesh_spacing/2)+(((((tub_length-(spacing*2))-(cage_endwall*2))-(((floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing))*mesh_spacing)+sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))))/2), cage_base])
   {
    for (h = [1 : floor(((cage_height-cage_base-((((((sin(90)*(cage_wall/sin(90-mesh_angle))))-((sin(mesh_angle)*((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/(sin(90))))))/sin(90))*sin(mesh_angle))))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing)])
     {
      translate(h*[0,0,mesh_spacing])
       {
        scale([1,1,(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/(((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/sin(90-mesh_angle))*sin(90))])
         {
        rotate([0,90-mesh_angle,0])
         {
          for (w = [1 : floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing)])
           {
            translate(w*[0,mesh_spacing,0])
             {
              rotate([0,0,45])
               {
//could put a scale command here to make opening a perfect square
                cube(size = [mesh_opening,mesh_opening,(mesh_opening*2)+(sin(90)*(cage_wall/sin(90-mesh_angle)))], center=false);
               }
             }
           }
//begin second row
         for (w = [0 : floor((((tub_length-(spacing*2))-(cage_endwall*2))-(sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening))))/mesh_spacing)])
           {
            translate([mesh_spacing/2,mesh_spacing/2,-mesh_spacing/2])
             {
              translate(w*[0,mesh_spacing,0])
               {
                rotate([0,0,45])
                 {
//could put a scale command here to make opening a perfect square
                cube(size = [mesh_opening,mesh_opening,(mesh_opening*2)+(sin(90)*(cage_wall/sin(90-mesh_angle)))], center=false);
                 }
               }
             }
           }
//end second row
         }
         }
       }
     }
   }
 }


}
//cutout lock_sphere
translate([((tub_width-(spacing*3))/2)/2,lock_depth-lock_radius,(cage_height)/2])
 {
  sphere(lock_radius);
 }
mirror([0,1,0])
 {
  translate([0,-(tub_length-(spacing*2)),0])
   {
    translate([((tub_width-(spacing*3))/2)/2,lock_depth-lock_radius,(cage_height)/2])
     {
      sphere(lock_radius);
     }
    }
   }
  }
}
half();
mirror([1,0,0])
 {
  translate([-((tub_width-(spacing*3))/2),0,0])
   {
  half();
   }
 }

//calculate verticle height of mesh holes to take away from max height of holes
//works okay up to 45 then bugs out. might be because its before the scale down
echo((((((sin(90)*(cage_wall/sin(90-mesh_angle))))-((sin(mesh_angle)*((sqrt((mesh_opening*mesh_opening)+(mesh_opening*mesh_opening)))/(sin(90))))))/sin(90))*sin(mesh_angle)));