question

Jose_antonio Ie avatar image
0 Likes"
Jose_antonio Ie asked Kavika F commented

Help with Code Snippet

Hello all,

I need your knowledge for resolving this (if possible).

I have the following code for creating 4 different FlowItems from a single Source but I need to set a different "label and colour" for each. E.g: label="box" & colour="red" for box FlowItem; label="cylinder" & colour="blue" for cylinder FlowItem and so on.

1656320652946.png

Thanks in advance for your support.

FlexSim 22.1.2
set labelcode snippetmultiple flow items
1656320702671.png (39.2 KiB)
· 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.

Jason Lightfoot avatar image Jason Lightfoot ♦ commented ·
Why have you asked this duplicate question - we answered it here.
0 Likes 0 ·
Kavika F avatar image Kavika F ♦ commented ·

Hi @Jose_antonio Ie, was Steven Hamoen's answer or Jason Lightfoot's comment helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

·
Steven Hamoen avatar image
1 Like"
Steven Hamoen answered

@Jose_antonio Ie

If you would first set a label with the duniform(1,4) code. Then use that label to set the different flow item types like you have done in your code. In the next step you can find, under the "Visual" option of the oncreation trigger, the option "Set color by case" If you select that option and use the label you set in the beginning again you can give each flow item type a different color. Then you can either change the code and in each case statement also set the label or use the same option again to set a unique label. I've attached a model.

There is 1 thing I want to warn you for and that is that you set the itemclass on creation, but this means that the next flowitem that is created will have this new class type and not the one currently being created!

SourceCreationTrigger.fsm


5 |100000

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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