question

Fiona Kattenstroth avatar image
1 Like"
Fiona Kattenstroth asked Fang J commented

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

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:

Thank you in advance!

FlexSim 20.2.2
flexsim 20.2.2visualevent-triggered sourceprocessflow icon
1600264245825.png (2.4 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.

Benjamin W2 avatar image Benjamin W2 commented ·

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 0 ·
Fiona Kattenstroth avatar image Fiona Kattenstroth commented ·

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

0 Likes 0 ·
1600322726672.png (10.8 KiB)
example.fsm (30.3 KiB)

1 Answer

Matthew Gillespie avatar image
4 Likes"
Matthew Gillespie answered Fang J commented

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


example-1.fsm (30.3 KiB)
· 3
5 |100000

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

Fang J avatar image Fang J commented ·

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

Software Version:

FlexSim 21.2.0
0 Likes 0 ·
enabled.fsm (31.0 KiB)
Jeanette F avatar image Jeanette F ♦♦ Fang J commented ·

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.

1 Like 1 ·
Fang J avatar image Fang J Jeanette F ♦♦ commented ·

thank you for your response

0 Likes 0 ·