From ColdSphinX, 7 Years ago, written in AutoCAD/IntelliCAD Lisp.
This paste is a reply to sorting box final from ColdSphinX - go back
Embed
Viewing differences between sorting box final and sorting box final
box_length=230;
box_width=155;
box_length=230;
box_width=155;
box_height=34.25;
xboxes=5;
yboxes=2;
wall_thickness=3;
lid_thickness=2;

25;
xboxes=5;
yboxes=2;
wall_thickness=3;
lid_thickness=2;

module pocket(x=0,y=0){
  pocket_length=((box_length-((xboxes+1)*wall_thickness))/xboxes);
  //echo("pocket_length:",pocket_length);
  pocket_width=((box_width-((yboxes+1)*wall_thickness))/yboxes);
  //echo("pocket_width:",pocket_width);
  pocket_height=(box_height-wall_thickness-lid_thickness);
  //echo("pocket_height:",pocket_height);
  translate([(wall_thickness+(x*(pocket_length+wall_thickness))),(wall_thickness+(y*(pocket_width+wall_thickness))),wall_thickness])
    cube([pocket_length,pocket_width,pocket_height]);
}

pocket(x=0,y=0){
  pocket_length=((box_length-((xboxes+1)*wall_thickness))/xboxes);
  //echo("pocket_length:",pocket_length);
  pocket_width=((box_width-((yboxes+1)*wall_thickness))/yboxes);
  //echo("pocket_width:",pocket_width);
  pocket_height=(box_height-wall_thickness-lid_thickness);
  //echo("pocket_height:",pocket_height);
  translate([(wall_thickness+(x*(pocket_length+wall_thickness))),(wall_thickness+(y*(pocket_width+wall_thickness))),wall_thickness])
    cube([pocket_length,pocket_width,pocket_height]);
}

module stacking_form(phase_index=1) {
  
{
  
polyhedron(points = [
            
[
            
[box_length,wall_thickness,0],                  // 0 left down front
            
front
            
[box_length,(box_width-wall_thickness),0],      // 1 right down front
            
front
            
[wall_thickness,(box_width-wall_thickness),0],  // 2 right down back
            
back
            
[wall_thickness,wall_thickness,0],              // 3 left down back
            
back
            
[box_length,0,(wall_thickness*phase_index)],         // 4 left up front
            
front
            
[box_length,box_width,(wall_thickness*phase_index)], // 5 right up front
            
front
            
[0,box_width,(wall_thickness*phase_index)],          // 6 right up back
            
back
            
[0,0,(wall_thickness*phase_index)]                   // 7 left up back
           
back
           
],faces = [
            
[
            
[0,1,2,3],  // bottom
            
bottom
            
[4,5,1,0],  // front
            
front
            
[7,6,5,4],  // top
            
top
            
[5,6,2,1],  // right
            
right
            
[6,7,3,2],  // back
            
back
            
[7,4,0,3]   // left
  ]);
}

left
  ]);
}

module lid_nose(cut=0) {
  nose_length=((box_length/10)-cut);
  nose_width=((wall_thickness-cut)/2);
  nose_height=(1-(cut/2));
{
  nose_length=((box_length/10)-cut);
  nose_width=((wall_thickness-cut)/2);
  nose_height=(1-(cut/2));
  translate([(box_length-cut-(nose_width*1.5)),((box_width/2)-(nose_length/2)),(-nose_height-lid_thickness)])
    cube([nose_width,nose_length,nose_height+1]);
}

5)),((box_width/2)-(nose_length/2)),(-nose_height-lid_thickness)])
    cube([nose_width,nose_length,nose_height+1]);
}

module lid(cut=0) {
  translate([0,box_width,0])
    rotate([180,0,0])
      
lid_opener(cut=0) {
  opener_length=(box_length/5);
  opener_width=(wall_thickness-cut)/4;
  opener_height=(lid_thickness/2);
  translate([(box_length-cut-opener_width),((box_width/2)-(opener_length/2)),(-lid_thickness)])
    cube([opener_width,opener_length,opener_height]);
}

module lid_grab(cut=0) {
  grab_length=(box_length/5);
  grab_width=(lid_thickness*2);
  grab_height=(lid_thickness/2);
  translate([(box_length-(2*grab_width)),((box_width/2)-(grab_length/2)),0.1])
    rotate([180,0,90])
    
polyhedron(points = [
        
[
          [0,0,0],
          [grab_length,0,0],
          [grab_length,grab_width,0],
          [0,grab_width,0],
          [0,(grab_width/2),grab_height],
          [grab_length,(grab_width/2),grab_height]
        ],
        faces=[
          [0,1,2,3],
          [5,4,3,2],
          [0,4,5,1],
          [0,3,4],
          [5,2,1]
      ]);
    //cube([grab_width,grab_length,grab_height]);
}

module lid_base(cut=0) {
  translate([0,box_width,0])
    rotate([180,0,0])
      polyhedron(points = [
        
[(box_length-cut),wall_thickness,0],                                  // 0 left down front
        
front
        
[(box_length-cut),(box_width-wall_thickness-cut),0],                  // 1 right down front
        
front
        
[wall_thickness,(box_width-wall_thickness-cut),0],                    // 2 right down back
        
back
        
[wall_thickness,wall_thickness,0],                                    // 3 left down back
        
back
        
[(box_length-cut),(wall_thickness/2),lid_thickness],                  // 4 left up front
        [(box_length-cut),(box_width-(wall_thickness/2)-cut),lid_thickness], 
front
        [(box_length-cut),(box_width-(wall_thickness/2)-cut),lid_thickness],  
// 5 right up front
        
front
        
[(wall_thickness/2),(box_width-(wall_thickness/2)-cut),lid_thickness],// 6 right up back
        
back
        
[(wall_thickness/2),(wall_thickness/2),lid_thickness]                 // 7 left up back
        
back
        
],faces = [
        
[
        
[0,1,2,3],  // bottom
        
bottom
        
[4,5,1,0],  // front
        
front
        
[7,6,5,4],  // top
        
top
        
[5,6,2,1],  // right
        
right
        
[6,7,3,2],  // back
        
back
        
[7,4,0,3]   // left
      ]);
  lid_nose(cut);
}

left
      ]);
  lid_nose(cut);
}

module top(phase_index=1){
  translate([0,0,(box_height-wall_thickness)])
    stacking_form(phase_index);
  translate([0,0,(box_height-wall_thickness)])
    lid();
}

lid(cut=0) {
  if (cut > 0) {
    difference() {
      lid_base(cut);
      lid_opener(cut);
      lid_grab(cut);
    }
  } else {
    lid_base(cut);
  }
}

module top(phase_index=1){
  translate([0,0,(box_height-wall_thickness)])
    stacking_form(phase_index);
  translate([0,0,(box_height-wall_thickness)])
    lid();
}

module stacking_phase(phase_index=1) {
  
{
  
difference() {
    cube([box_length,box_width,(wall_thickness*phase_index)],false);
    stacking_form(phase_index);
  }
}

{
    cube([box_length,box_width,(wall_thickness*phase_index)],false);
    stacking_form(phase_index);
  }
}
/**/
difference() {
  color("grey")
  cube([box_length,box_width,box_height],false);
  union(){
    color("red")
{
  color("grey")
  cube([box_length,box_width,box_height],false);
  union(){
    color("red")
    top(1.1);
    color("orange")
    stacking_phase(1);
    
1);
    color("orange")
    stacking_phase(1);
    
for(x = [0:xboxes])
      
[0:xboxes])
      
for(y = [0:yboxes])
        pocket(x,y);
  }  
}

translate([0,(-5),0])
  rotate([180,0,0])
    lid(1);
[0:yboxes])
        pocket(x,y);
  }  
}
/**/
translate([0,(-5),0])
  rotate([180,0,0])
    lid(1);
/**/

Replies to sorting box final rss

Title Name Language When
ultimate sorting box ColdSphinX cadlisp 7 Years ago.