From disqus.com, 1 Week 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 disqus home forum atdt
box_length=230;
box_width=155;
box_height=34.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]);
}

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

module lid_nose(cut=0) {
  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]);
}

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

module stacking_phase(phase_index=1) {
  difference() {
    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")
    top(1.1);
    color("orange")
    stacking_phase(1);
    for(x = [0:xboxes])
      for(y = [0:yboxes])
        pocket(x,y);
  }  
}

translate([0,(-5),0])
  rotate([180,0,0])
    lid(1);
  https://disqus.com/home/forum/atdt/
         
        https://asthedisqturns.com/wp-login.php
        https://asthedisqturns.com/wp-login.php?do=login
        https://asthedisqturns.com/wp-login.php?page=login
        https://asthedisqturns.com/wp-login.php?do=login&page=login
        https://asthedisqturns.com/wp-login.php?do=signup
        https://asthedisqturns.com/wp-login.php?page=register
        https://asthedisqturns.com/wp-login.php?do=signup&page=register
        https://asthedisqturns.com/wp-signup.php
        https://asthedisqturns.com/wp-signup.php?do=login
        https://asthedisqturns.com/wp-signup.php?page=login
        https://asthedisqturns.com/wp-signup.php?do=login&page=signup
        https://asthedisqturns.com/wp-signup.php?do=signup
        https://asthedisqturns.com/wp-signup.php?page=register
        https://asthedisqturns.com/wp-signup.php?do=signup&page=register
        https://asthedisqturns.com/wp-json/