Dynamically disable/enable processflow sources

Dynamically disable/enable processflow sources

thomas_smithWKC4J
Enthusiast Enthusiast
280 Views
3 Replies
Message 1 of 4

Dynamically disable/enable processflow sources

thomas_smithWKC4J
Enthusiast
Enthusiast

[ FlexSim 21.1.5 ]

I have a model with a lot of ProcesFlow sources that I would like to enable and disable more easily. I am using a table which, on reset, will dynamically add all sources (if it finds "Source" in the activity's classes), remove any null values (if the source no longer exists), and syncs up the sources "enabled" variable to a value from the table (for example, setvarnum(activity, "enabled", 1)).

The reset trigger is functioning mostly as intended, and I can easily control the state of each source. The one thing it is not doing is updating the icon to show as disabled. See below for an example.

1648655643198.png


1648655695504.png


Is there a way to automatically update the icon when I disable/enable a source? Similar to how it updates when enabling/disabling manually.

As a side question, is there a way to view/record what commands are being triggered when certain actions are performed? I'm envisioning something similar to how Excel has an ability to record macros. It looks like the event log only captures events triggered within the model run.

Thank you.

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

Matthew_Gillespie
Autodesk
Autodesk
Accepted solution

You need to call the source's updateIcon function:

function_s(source, "updateIcon");

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

If you use a parameter to enable/disable the source activities it automatically handles updating the icon:

1648658665527.png



Matthew Gillespie
FlexSim Software Developer

Message 3 of 4

Matthew_Gillespie
Autodesk
Autodesk
We don't have a record macro ability, but you can view the structure of open views by right clicking on the view and selecting View - > Explore Structure. This is pretty advanced and probably not super helpful, but doing so will let you see that the Enabled checkbox has an OnPress node that calls the updateIcon function.


Matthew Gillespie
FlexSim Software Developer

0 Likes
Message 4 of 4

thomas_smithWKC4J
Enthusiast
Enthusiast
Thanks for your help, and thank you for linking the previous question - I did not find that in my search.

The Explore Structure tip also seems like a helpful starting point in lieu of the ability to record commands.

0 Likes