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

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

sakamoto_ryosuke
Collaborator Collaborator
26 Views
4 Replies
Message 1 of 5

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

sakamoto_ryosuke
Collaborator
Collaborator

[ FlexSim 21.0.6 ]

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

capture003.jpg

0 Likes
Accepted solutions (1)
27 Views
4 Replies
Replies (4)
Message 2 of 5

moehlmann_fe
Explorer
Explorer
Accepted solution

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.

Message 3 of 5

sakamoto_ryosuke
Collaborator
Collaborator
@Felix Möhlmann Thank you so much! This is exactly what I wanted!!
Message 4 of 5

1527240595
Participant
Participant

Hello, what should I do if I want to get the total number of slots on the Rcak?

0 Likes
Message 5 of 5

joerg_vogel_HsH
Mentor
Mentor
@LJC, typically you ask a new question. You can query slots by a condition for a rack object or its name.