From ColdSphinX, 7 Years ago, written in AutoCAD/IntelliCAD Lisp.
Embed
  1. box_length=230;
  2. box_width=155;
  3. box_height=34.25;
  4. xboxes=5;
  5. yboxes=2;
  6. wall_thickness=3;
  7. lid_thickness=2;
  8.  
  9. module pocket(x=0,y=0){
  10.   pocket_length=((box_length-((xboxes+1)*wall_thickness))/xboxes);
  11.   //echo("pocket_length:",pocket_length);
  12.   pocket_width=((box_width-((yboxes+1)*wall_thickness))/yboxes);
  13.   //echo("pocket_width:",pocket_width);
  14.   pocket_height=(box_height-wall_thickness-lid_thickness);
  15.   //echo("pocket_height:",pocket_height);
  16.   translate([(wall_thickness+(x*(pocket_length+wall_thickness))),(wall_thickness+(y*(pocket_width+wall_thickness))),wall_thickness])
  17.     cube([pocket_length,pocket_width,pocket_height]);
  18. }
  19.  
  20. module stacking_form(phase_index=1) {
  21.   polyhedron(points = [
  22.             [box_length,wall_thickness,0],                  // 0 left down front
  23.             [box_length,(box_width-wall_thickness),0],      // 1 right down front
  24.             [wall_thickness,(box_width-wall_thickness),0],  // 2 right down back
  25.             [wall_thickness,wall_thickness,0],              // 3 left down back
  26.             [box_length,0,(wall_thickness*phase_index)],         // 4 left up front
  27.             [box_length,box_width,(wall_thickness*phase_index)], // 5 right up front
  28.             [0,box_width,(wall_thickness*phase_index)],          // 6 right up back
  29.             [0,0,(wall_thickness*phase_index)]                   // 7 left up back
  30.            ],faces = [
  31.             [0,1,2,3],  // bottom
  32.             [4,5,1,0],  // front
  33.             [7,6,5,4],  // top
  34.             [5,6,2,1],  // right
  35.             [6,7,3,2],  // back
  36.             [7,4,0,3]   // left
  37.   ]);
  38. }
  39.  
  40. module lid_nose(cut=0) {
  41.   nose_length=((box_length/10)-cut);
  42.   nose_width=((wall_thickness-cut)/2);
  43.   nose_height=(1-(cut/2));
  44.   translate([(box_length-cut-(nose_width*1.5)),((box_width/2)-(nose_length/2)),(-nose_height-lid_thickness)])
  45.     cube([nose_width,nose_length,nose_height+1]);
  46. }
  47.  
  48. module lid(cut=0) {
  49.   translate([0,box_width,0])
  50.     rotate([180,0,0])
  51.       polyhedron(points = [
  52.         [(box_length-cut),wall_thickness,0],                                  // 0 left down front
  53.         [(box_length-cut),(box_width-wall_thickness-cut),0],                  // 1 right down front
  54.         [wall_thickness,(box_width-wall_thickness-cut),0],                    // 2 right down back
  55.         [wall_thickness,wall_thickness,0],                                    // 3 left down back
  56.         [(box_length-cut),(wall_thickness/2),lid_thickness],                  // 4 left up front
  57.         [(box_length-cut),(box_width-(wall_thickness/2)-cut),lid_thickness], // 5 right up front
  58.         [(wall_thickness/2),(box_width-(wall_thickness/2)-cut),lid_thickness],// 6 right up back
  59.         [(wall_thickness/2),(wall_thickness/2),lid_thickness]                 // 7 left up back
  60.         ],faces = [
  61.         [0,1,2,3],  // bottom
  62.         [4,5,1,0],  // front
  63.         [7,6,5,4],  // top
  64.         [5,6,2,1],  // right
  65.         [6,7,3,2],  // back
  66.         [7,4,0,3]   // left
  67.       ]);
  68.   lid_nose(cut);
  69. }
  70.  
  71. module top(phase_index=1){
  72.   translate([0,0,(box_height-wall_thickness)])
  73.     stacking_form(phase_index);
  74.   translate([0,0,(box_height-wall_thickness)])
  75.     lid();
  76. }
  77.  
  78. module stacking_phase(phase_index=1) {
  79.   difference() {
  80.     cube([box_length,box_width,(wall_thickness*phase_index)],false);
  81.     stacking_form(phase_index);
  82.   }
  83. }
  84.  
  85. difference() {
  86.   color("grey")
  87.   cube([box_length,box_width,box_height],false);
  88.   union(){
  89.     color("red")
  90.     top(1.1);
  91.     color("orange")
  92.     stacking_phase(1);
  93.     for(x = [0:xboxes])
  94.       for(y = [0:yboxes])
  95.         pocket(x,y);
  96.   }  
  97. }
  98.  
  99. translate([0,(-5),0])
  100.   rotate([180,0,0])
  101.     lid(1);
  102.  

Replies to sorting box final rss

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