question

Ryosuke S avatar image
0 Likes"
Ryosuke S asked Ryosuke S commented

How to get the numbers of Bays, Levels and slots in FlexScript?

How can I get the values (number of Bays, Levels, and slots) set in the Dimensions of the storage?

capture003.jpg

FlexSim 21.0.6
flexscriptfloorstoragedimensions
capture003.jpg (15.5 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

Felix Möhlmann avatar image
1 Like"
Felix Möhlmann answered Ryosuke S commented

You can access the bays directly from the storage object.

Storage.Object Rack = <Insert reference to object here>;
int BayNum = Rack.bays.length;

As each bay might have a different number of levels, you have to define for which bay you want to access the levels.

Storage.Bay CurrentBay = Rack.bays[<Index of the bay>];
int LevelNum = CurrentBay.levels.length;

In the same way, the slots are accessed through each level.

Storage.Level CurrentLevel = CurrentBay.levels[<index of the level>];
int SlotNum = CurrentLevel.slots.length;

For an example of how this is used, you can look at the code of the default options for the "Slot Assignment Strategy" of a rack or floor storage.

· 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.

Ryosuke S avatar image Ryosuke S commented ·
@Felix Möhlmann Thank you so much! This is exactly what I wanted!!
1 Like 1 ·