extensive refactoring

This commit is contained in:
2018-10-03 23:07:50 -07:00
parent 54d41573cf
commit e8e676a27c

View File

@@ -1,4 +1,4 @@
make_frame=0; // 0=make drawer, 1=make frame
make_frame=1; // 0=make drawer, 1=make frame
// drawer parameters
@@ -9,7 +9,7 @@ enable_tag_holder=1; // set to 0 to disable (auto-disabled for width<18mm or hei
// frame parameters
x_count=2; // number of columns of drawers
x_count=3; // number of columns of drawers
y_count=3; // number of rows of drawers
// printer and slicer parameters
@@ -128,109 +128,6 @@ module frame_base()
}
}
module frame_1x1()
{
frame_base();
}
module frame_1x2()
{
difference()
{
frame_base();
translate([0,total_height/2-gap/2,base_thickness])
cube([total_width-2*nozzle_width,gap,depth]);
}
}
module frame_2x1()
{
difference()
{
frame_base();
translate([total_width/2-gap/2,0,base_thickness])
cube([gap,total_height-2*nozzle_width,depth]);
}
}
module frame_2x2()
{
difference()
{
frame_base();
translate([0,total_height/2-gap/2,base_thickness])
cube([total_width-2*nozzle_width,gap,depth]);
translate([total_width/2-gap/2,2*nozzle_width,base_thickness])
cube([gap,total_height-4*nozzle_width,depth]);
}
}
module frame_3x1()
{
difference()
{
frame_base();
translate([total_width/3-gap/2,0,base_thickness])
cube([gap,total_height-2*nozzle_width,depth]);
translate([2*total_width/3-gap/2,2*nozzle_width,base_thickness])
cube([gap,total_height-2*nozzle_width,depth]);
}
}
module frame_1x3()
{
difference()
{
frame_base();
translate([0,total_height/3-gap/2,base_thickness])
cube([total_width-2*nozzle_width,gap,depth]);
translate([0,2*total_height/3-gap/2,base_thickness])
cube([total_width-2*nozzle_width,gap,depth]);
}
}
module frame_3x2()
{
difference()
{
frame_base();
translate([0,total_height/2-gap/2,base_thickness])
cube([total_width-2*nozzle_width,gap,depth]);
translate([total_width/3-gap/2,2*nozzle_width,base_thickness])
cube([gap,total_height-4*nozzle_width,depth]);
translate([2*total_width/3-gap/2,2*nozzle_width,base_thickness])
cube([gap,total_height-4*nozzle_width,depth]);
}
}
module frame_2x3()
{
difference()
{
frame_base();
translate([total_width/2-gap/2,0,base_thickness])
cube([gap,total_height-2*nozzle_width,depth]);
translate([2*nozzle_width,total_height/3-gap/2,base_thickness])
cube([total_width-4*nozzle_width,gap,depth]);
translate([2*nozzle_width,2*total_height/3-gap/2,base_thickness])
cube([total_width-4*nozzle_width,gap,depth]);
}
}
module frame_3x3()
{
difference()
@@ -254,25 +151,75 @@ module frame_3x3()
}
}
module frame_x1(c)
{
difference()
{
frame_base();
if (c>1)
for (i=[1:c-1])
translate([i*total_width/x_count-gap/2,0,base_thickness])
cube([gap,total_height-2*nozzle_width,depth]);
}
}
module frame_1x(c)
{
difference()
{
frame_base();
if (c>1)
for (i=[1:c-1])
translate([0,i*total_height/y_count-gap/2,base_thickness])
cube([total_width-2*nozzle_width,gap,depth]);
}
}
module frame_x2(c)
{
difference()
{
frame_base();
translate([0,total_height/2-gap/2,base_thickness])
cube([total_width-2*nozzle_width,gap,depth]);
if (c>1)
for (i=[1:c-1])
translate([i*total_width/x_count-gap/2,2*nozzle_width,base_thickness])
cube([gap,total_height-4*nozzle_width,depth]);
}
}
module frame_2x(c)
{
difference()
{
frame_base();
translate([total_width/2-gap/2,0,base_thickness])
cube([gap,total_height-2*nozzle_width,depth]);
if (c>1)
for (i=[1:c-1])
translate([2*nozzle_width,i*total_height/y_count-gap/2,base_thickness])
cube([total_width-4*nozzle_width,gap,depth]);
}
}
if (make_frame==1)
{
if (x_count==1 && y_count==1)
frame_1x1();
if (x_count==1 && y_count==2)
frame_1x2();
if (x_count==2 && y_count==1)
frame_2x1();
if (x_count==2 && y_count==2)
frame_2x2();
if (x_count==3 && y_count==1)
frame_3x1();
if (x_count==1 && y_count==3)
frame_1x3();
if (x_count==3 && y_count==2)
frame_3x2();
if (x_count==2 && y_count==3)
frame_2x3();
if (x_count==3 && y_count==3)
if (y_count==1)
frame_x1(x_count);
else if (x_count==1)
frame_1x(y_count);
else if (y_count==2)
frame_x2(x_count);
else if (x_count==2)
frame_2x(y_count);
else if (x_count==3 && y_count==3)
frame_3x3();
}
else