How can I change the color of boxes create in pallet using run sub flow?

How can I change the color of boxes create in pallet using run sub flow?

lemonia_a
Not applicable
908 Views
3 Replies
Message 1 of 4

How can I change the color of boxes create in pallet using run sub flow?

lemonia_a
Not applicable

[ FlexSim 19.2.2 ]

I attached you may find my model.

0-model-boxes-in-pallet-change-visual-color.fsm

0 Likes
Accepted solutions (1)
909 Views
3 Replies
Replies (3)
Message 2 of 4

joerg_vogel_HsH
Mentor
Mentor
Accepted solution

25067-get-access-to-token-rank-subflow.jpg

This approach is using a local variable of the assign source code. If you open the source code editor by the parchment roll icon, you the header of the source code. There is avariable declared that give you a rank number to the created items.

Object current = param(1);
treenode activity = param(2);
Token token = param(3);
Token createdToken = param(4);
Variant assignTo = createdToken;
int creationRank = param(5);
string labelName = param(6);
treenode processFlow = ownerobject(activity);

header of the Assign Labels to Children: Value: Source Code editor

Another approach needs a bit earlier a different setting. The activity create boxes inside pallet has got an option to store all created boxes as an array to a label at the token. The Option Insert in Front of does this for token.item.

An Array can be reduced by the first or last value, and this value is returned thereby by pop() or shift().

25071-get-access-to-token-rank-subflow-by-pop.jpg

The Run Sub Flow activity sets to the child tokens a label named pallet_item. This label holds a reference to a single box of the array.

0 Likes
Message 3 of 4

natalia_g6
Not applicable

Hi @Jörg Vogel , In this case, if I create boxes with different labels and I want to assing a color dependig of the label that the box has, how can i do it?

Thanks

0 Likes
Message 4 of 4

joerg_vogel_HsH
Mentor
Mentor

perhaps an administrator will move this part as a new question:

Add a new color palette in the toolbox 35207-colorpalette-by-number.png

Edit the number names of the pallete to match with your label values.

35208-change-color-from-palette-by-value.png

use color palette in method fromPalette to assign a color,

change_color_by_label_value.fsm

0 Likes