How can I change the visual of a source by FlexScript?

How can I change the visual of a source by FlexScript?

fiona_k
Not applicable
1,306 Views
6 Replies
Message 1 of 7

How can I change the visual of a source by FlexScript?

fiona_k
Not applicable

[ FlexSim 20.2.2 ]

Does anybody have an idea how I can change the visual of an event triggered source in the Processflow when I'm using FlexScript to enable/ disable it? To fill the checkbox I used these expressions and they worked properly:

setvarnum(Model.find("Tools/ProcessFlow/ProcessFlow/Source"), "enabled", 0);

setvarnum(Model.find("Tools/ProcessFlow/ProcessFlow/Source"), "enabled", 1);

But even if the source is enabled, the event triggered source is crossed out: 32663-1600264245825.png

Thank you in advance!

Accepted solutions (1)
1,307 Views
6 Replies
Replies (6)
Message 2 of 7

benjamin_w2
Not applicable

Hi @fiona.k, The icon on my source does not change when I enable/disable the node. Can you post an example model of what you are seeing?

0 Likes
Message 3 of 7

fiona_k
Not applicable

Hi @benjamin.w2, that's exactly the problem. I attached an example model. 32693-1600322726672.pngexample.fsm

0 Likes
Message 4 of 7

Matthew_Gillespie
Autodesk
Autodesk
Accepted solution

To get the icon to update you need to call the "updateIcon" function on the activity as well.

treenode source = Model.find("Tools/ProcessFlow/ProcessFlow/Source");
setvarnum(source, "enabled", checked);
function_s(source, "updateIcon");

example_1.fsm



Matthew Gillespie
FlexSim Software Developer

Message 5 of 7

kuooge009
Contributor
Contributor

enabled.fsmhi@Matthew Gillespie,Although the icon has changed, why does the token still flow.

Software Version:

FlexSim 21.2.0
0 Likes
Message 6 of 7

Jeanette_Fullmer
Community Manager
Community Manager

Hello @Fang J,

When I place a "Breathe" activity (Delay activity with a delay value of 0) between the custom code and create object activities it works great. Here is a post that gives some explanation for "Breathe" activities.

Message 7 of 7

kuooge009
Contributor
Contributor

thank you for your response

0 Likes