question

gonzalo avatar image
0 Likes"
gonzalo asked Jason Lightfoot edited

Custom Stacking Order

Hello, I want to change the stacking sequence from left to right, then going up to left to right again and so on for my custom flow item. I attached an image showing that i've complete the first "level" but i coudn't go up any further. Could you guys help me with this?. Any help i'd appreciate it

1699198797308.pngstoring.fsm


FlexSim 22.2.0
stacking item
1699198797308.png (120.2 KiB)
storing.fsm (38.7 KiB)
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

Kavika F avatar image
0 Likes"
Kavika F answered gonzalo commented

Hey @gonzalo, you can get your desired outcome by changing the Slot Assignment Strategy. You can customize it a bit by adding a "numItems" and checking that against each slot's number of items. If you find one that has fewer, then save that slot. Assign the slot at the end.

  1. Storage.Object current = ownerobject(c);
  2. Object item = param(1);
  3. Storage.Item storageItem = Storage.Item(item);
  4.  
  5. int numItems = INT_MAX;
  6. Storage.Slot retSlot;
  7. /***popup:SlotByCondition*/
  8. /**First Slot with Space*/
  9. for (int i = 1; i <= current.bays.length; i++) {
  10. Storage.Bay bay = current.bays[i];
  11. for (int j = 1; j <= bay.levels.length; j++) {
  12. Storage.Level level = bay.levels[j];
  13. for (int k = 1; k <= level.slots.length; k++) {
  14. Storage.Slot slot = level.slots[k];
  15. int mustHaveSpace = /**\r\nMust Have Space: *//***tag:mustHaveSpace*//**/1/**/;
  16. if (!slot.isStorable || (mustHaveSpace && !slot.hasSpace(item)))
  17. continue;
  18. if (slot.slotItems.length < numItems) {
  19. numItems = slot.slotItems.length;
  20. retSlot = slot;
  21. }
  22. }
  23. }
  24. }
  25.  
  26. storageItem.assignedSlot = retSlot;
  27. return 0;
· 1
5 |100000

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