Through environments, modules can be used to completely change the interface of FlexSim. Each module can have a set of environments where each environment is a set of additions and replacements that are not applied with the rest of the module when FlexSim opens. Instead, these changes can be applied at any time by switching into an environment. Exiting the environment will restore FlexSim to it's default environment.
Environments have a set of installdata that works like a standard module, adding and replacing nodes in the tree. You can also define events or code that fires when an environment is entered into or exited. A set of options can be defined allowing you to remove the Run and FlexSim Toolbar and setting the y location of the Main Panel. You can also define a workspace, or the set of windows, that the environment opens into.
There are three locations that environments are/can be defined:
Adding an environment to a module is very easy. In the module node (MAIN:/modules/SomeModule), simply add a node called environments; this node should be a sibling to the module's installdata node. Within this node, create a node with the name of your environment. The environment node must contain an installdata node just like the module does that will be used to store the additions and replaces of the environment. In the end, the structure should look something like this:
Here, the ExpressIt3D module provides a single environment with the same name. An optional events node is also shown; environment events will be discussed later.
If a model environment is defined, it must follow the same structure as the modules node. This is in prepration for future developments where models may apply their own module-like changes to FlexSim.
Once this is done, you can refresh the environments by calling:
Environments in a model will be saved when the model is saved. Module environments will be saved at the same time modules are saved by calling:
If you have a model environment, then you can add and remove nodes to or from that environment like usual. However, you will not be able to save an environment workspace. This is because the model saves the current workspace. So if you want to make a stripped-down interface, maybe leaving only a simple menu and toolbar, then do the following. First, add and remove nodes, and set the environment options, just like you would for a module environment. Then, add a user event for OnModelOpen that switches to the environment when the model is opened. Finally, set up the UI, leaving only the desired windows open and placed properly. Then, save the model. When you open the model, the environment will be applied, followed by the workspace.
Once an environment has been added to a model or module and environments have been refreshed, a button will appear on the right side of the user toolbar. This will display a list of all available environments to switch to.
You can also use the following command:
applicationcommand("switchtoenvironment", "Environment Name");
The following events happen in order when an environment is being switched:
To exit an environment use and return to FlexSim's default view use:
You can also press Ctrl + Alt + E to exit an environment if no script window or Environments button is available.
In order to add or replace nodes for an environment, you must be in the environment. Once in an environment, right-clicking on a node in the tree will give you the Current Environment menu option. This option is disabled if there is no current environment.
As with a module, select Add as addition to add a node to the environment, Add as replacement to replace a node and Remove to remove an addition or replacement.
Note: When replacing a node, make sure to select Add as replacement BEFORE editing the replaced node. This will place a copy of the current state of the node into the environments installdata.
The Save active view as environment default option will save the current state of the workspace including all docked and floating windows and will be opened when the environment is first opened. If a user enters an environment and alters the window configuration and then exits the environment, the last configuration will be saved so that the user will return to that configuration when they reopen the environment. This is also the functionality of standard FlexSim. When an environment is entered the model saves off FlexSim's workspace for use when the environment is closed. This allow the user to more seamlessly switch between multiple environments and FlexSim.
Environment options allow you to change aspects of FlexSim that are not available from within the tree. Though you can make some changes to the Run and FlexSim Toolbar, completely replacing them will have dire results. This is also true of the BackPanel. Changing the workspace for your environment should be done by setting the workspace to the desired layout and then selecting Save active view as environment default. The Current Environment menu option will display when right-clicking in a tree view OR when right-clicking in the space to the right of a tab pane.
You may make changes to the items in the Run Toolbar and FlexSim Toolbar, but if you wish to remove them completely and/or you want to change the y location of the BackPanel, use the following options: