I want to add a button in dashboard which would enable to disable certain process flow in my model. Is it possible to do that?
I want to add a button in dashboard which would enable to disable certain process flow in my model. Is it possible to do that?
Hi @Jay K9, was Jonah K's answer 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 comment back to reopen your question.
There's a couple of different ways you can accomplish this. One way that you can do it is to create a GUI button that changes the "enabled" variable in a source activity, using this code in the OnPress node (Flow1):
treenode mysource1 = getactivity("ProcessFlow", "Source1"); int enableval = getvarnum(mysource1, "enabled"); setvarnum(mysource1, "enabled", !enableval); function_s(mysource1, "updateIcon"); repaintall();
The downside is that this method requires that you reset the model each time you press the button.
If you want to be able to click the button during the model run, you could create a button which will redirect tokens to an alternate branch on a Decide activity using a Global Variable, with this code (Flow2):
treenode globalvar = Model.find("Tools/GlobalVariables/Variable1"); globalvar.subnodes[3].value = !globalvar.subnodes[3].value;
You can reconfigure any of these two methods to fit your needs. Here's an example model:
Hello
This contribution has helped me a lot.
It’s very important to note that this works if the Model Reset button is pressed. In my case, I enabled a checkbox in the GUI to activate or desactivate the Source Events and added this code in a Model Trigger on Reset. If I put it on Start, it didn’t work until I pressed Reset again, which is why I noticed that Jonah K mentioned it worked if Reset was pressed.
If anyone is interested, I can upload a sample model of how I did it, but I think Jonah's response is very well explained.
16 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved