question

Lemonia A avatar image
0 Likes"
Lemonia A asked Joerg Vogel commented

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

I attached you may find my model.

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

FlexSim 19.2.2
process flowchange visualchange colorrun sub flow
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

Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Joerg Vogel commented

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().

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.


· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Natalia G6 avatar image Natalia G6 commented ·

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 0 ·
Joerg Vogel avatar image Joerg Vogel Natalia G6 commented ·

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

Add a new color palette in the toolbox

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

use color palette in method fromPalette to assign a color,

change_color_by_label_value.fsm

0 Likes 0 ·