question

Terra K. avatar image
0 Likes"
Terra K. asked Joerg Vogel commented

Operators carry 3 columns of boxes

By default, operators carry the items no matter how many of it, it goes up in one stack. However, when i want it to be on the task executor which is to be pushed by the operator, i want it to be stacked in 3 columns, for example if the bottom is filled with 3 boxes already, it moves to a higher level and so on. I've tried setloc() but it still only contains one column.

FlexSim 17.1.2
operatoroperatorstaskexecutor
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Joerg Vogel avatar image
4 Likes"
Joerg Vogel answered Joerg Vogel commented

Here an example that may show you, how to do it:

  1. /**Custom Code - change Location of loaded items to three in a row*/
  2. Object item = param(1);
  3. Object current = ownerobject(c);
  4. Object station = param(2);
  5. //*** New Code ***
  6. int loadedItems = current.subnodes.length;
  7. if(loadedItems> 1){
  8. int level = (loadedItems-1)/3;
  9. // integer division to get the level in z direction
  10. int place = ((2+loadedItems)%3);
  11. // I need the series 0, 1, 2 dependency of the amount of loaded items
  12. // (1+2)%3 = 0; (2+2)%3 = 1; (3+2)%3 = 2; (4+2)%3 = 0;...
  13. treenode loaded1st = current.subnodes[1];
  14. // root item to place the other
  15. double locX = loaded1st.as(Object).location.x
  16. + loaded1st.as(Object).size.x*place;
  17. // I assume the size is constant
  18. double locY = item.location.y;
  19. // y location does not change
  20. double locZ = loaded1st.as(Object).location.z
  21. +(item.size.z*level);
  22. item.setLocation(locX, locY, locZ);}
· 4
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.