article

Paul Toone avatar image
0 Likes"
Paul Toone posted

Script Console   

A Script Concsole can be accessed through either the Debug menu >Script Console, or through the FlexSim Toolbar.

The script console allows you to execute flexscript commands on the fly without needing to run your model. This can be useful for getting information from your model as well as configuring your model. Type the flexscript code in the main field at the bottom of the window and press the . If your code has a return value, this value will be displayed in the results field. If you are executing a command with a return value like, getlabel and your code consists of only one line, you can ommit the return and the semi-colon at the end of the line to see the return value in the results field.

You can use the Sampler button to reference objects and paths in your model. For more information, see the Sampler page.

If you need to debug your code, you can enter debugging mode by clicking the of the but and select Debug. This will place a debug point at line 1 of your code, open it in a Code Editor and execute the code.

Saving and Loading Scripts

Saving

Code entered into the Script Console can be saved as either a Model Script or a User Script by pressing .

- Saves the current script. If the script has not yet been saved, opens the Save As popup.

- Opens the Save As popup.

A list of previously saved scripts is available by pressing the .

Save As User Script - These scripts are saved in the user preferences folder (VIEW:/enviornment). These scripts are available for all models while FlexSim is open under your user.

Save As Model Script - These scripts are saved in the model's /Tools/Scripts folder. They are only available for the current model.

Loading

Saved scripts can be loaded by pressing thebutton. A menu will appear with a list of all Model Scripts, separated by a line, and then all your User Scripts.

Empy Script - Closes any currently open script and clears the code field.

Managing Saved Scripts

As seen in the above image, Change Variables contains a sub-menu of further Model Scripts. You can organize your scripts through any number of sub-menus. To manage your scripts, click thebutton and select Manage model scripts... or Manage user scripts.... A Tree Window will appear.

From here, you can organize your scripts by creating sub-nodes and renaming any of your scripts. For more information on using the Tree, see the FlexSim Concepts - Model Tree View or the Tree Structure page.



flexsim users manualusers manual
5 |100000

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

Article

Contributors

paul.t contributed to this article

Navigation

FlexSim 2016.1