User:Dorkmo/Ideas/Battery/SCAD/Sandbox: Difference between revisions
(→cage) |
|||
| Line 275: | Line 275: | ||
</nowiki> | </nowiki> | ||
===cage with old mesh=== | |||
<nowiki> | |||
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))); | |||
</nowiki> | |||
===inside cage=== | ===inside cage=== | ||
Revision as of 02:50, 15 November 2014
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 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));
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);
}
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)));