question

j08j avatar image
0 Likes"
j08j asked j08j commented

assigning box to certain slot by FlexScript

I try to store 15 boxes in certain bay, level and slot, e.g. slot(2, 3, 1), by using FlexScript. But it stored all boxes in slot(1, 1, 1), which is not follow the assignment.

screenshot-2024-03-19-at-23154-pm.png

Test_1.fsm

FlexSim 24.0.2
flexscriptcoderackrestoreitem
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
0 Likes"
Felix Möhlmann answered j08j commented

To assign a slot to an item you need a pointer reference to that item. Which your code doesn't have. This also means that the item must exist in the first place, so you can't assign slots before the start of the model. It has to happen during the runtime.

One option would be to assign the slot in the On Creation trigger of the source. This trigger provides a pointer to the created item.

1710838202222.png


1710838202222.png (15.9 KiB)
· 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.

j08j avatar image j08j commented ·

Thanks a lot. That's worked fine!

0 Likes 0 ·