question

bcolmery avatar image
0 Likes"
bcolmery asked bcolmery commented

Pull From Array Based on 3D Object Label

I have 4 carts on an AGV. Two of the carts have VinylLine label value "L2" and two of the carts have a label value "L3".

1723738813884.png1723738837715.png


In my process flow, the carts are represented in the "pulledIGUCart" array below.

1723738959851.png


I want to unload the 2 carts labeled "L3" into a queue. How do I remove them from the array based on 3D object label values?

FlexSim 24.0.2
arraylabel value
1723738813884.png (37.6 KiB)
1723738837715.png (6.8 KiB)
1723738959851.png (29.3 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
0 Likes"
Felix Möhlmann answered bcolmery commented

If the goal is to actually remove the entries from the array, then you have to loop through all entries, splicing out the items with the "correct" label value. See example code below.

string matchValue = "L2";
Array itemsToMove = []; Array loadedItems = token.totalIGUCart; for(int i = 1; i <= loadedItems.length; i++) {     if(loadedItems[i].VinylLine == matchValue)     {         itemsToMove.push(loadedItems[i]);         loadedItems.splice(i, 1);         i--;     } }

If it's Ok for the entries to stay in the array (label is not used label) you can push all items to a list and pull only the ones with the target label value (query: WHERE VinylLine == 'L2')

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

bcolmery avatar image bcolmery commented ·
I'm good with entries remaining in the array, so I used the WHERE query and it worked. Thanks!
0 Likes 0 ·