How to Call Model Scripts Outside Script Console

How to Call Model Scripts Outside Script Console

stan.e.davis
Advocate Advocate
6 Views
2 Replies
Message 1 of 3

How to Call Model Scripts Outside Script Console

stan.e.davis
Advocate
Advocate

[ FlexSim 22.2.2 ]

In addition to User Commands, I create a number of model scripts via the Script Console. I would like to call some of them directly via Button OnPress events. How do I do that without having to create a User Command first? Thanks.

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

philboboADSK
Autodesk
Autodesk
Accepted solution

You can add a node in the tree with FlexScript data and call nodefunction() on it, or you can copy it into a text node and call executefsnode() on it, or you can put it in a string somewhere and call executestring() on it, or you can create a user command, as you are aware. You can also copy/paste the code into your Button's OnPress code.

A user command is the best option for storing reusable code in the model to be called from multiple places. Why would you not want to "create a User Command first"? Your qualification makes no sense; a user command does exactly what you want to do. I don't understand.



Phil BoBo
Sr. Manager, Software Development
0 Likes
Message 3 of 3

stan.e.davis
Advocate
Advocate
Phil, Thanks for providing the options. I'll stay with the User Command route. - Stan
0 Likes