In Cameo Simulation Toolkit, you can use the following types of action scripts to manipulate runtime objects:
ALH (Action Language Helper) scripts. Example: ALH.getValue(object, "property")
Action scripts can be used anywhere where scripts are evaluated during simulation (e.g., Opaque Behaviors, Actions, Guards, or even directly in the simulation Console pane). You can use them to get and specify a Structural Feature value, call a specific behavior or operation, create a runtime object, get its current State, create a Signal instance, and more.
Note that scripts depend on the objects where they are executed, i.e., scripts are context-dependent. |
When executing a script, you always need to specify its context (object). Most commonly, it is the current simulation context (marked as "self" in a script). However, it can also be an input pin (pin name) or an object created in a script itself (see Creating a runtime object).
Analyze the example described below to see how scripts change depending on the context.
In the example below, to get the Diameter Value Property when the script is executed in the Car Block, the script should be self.get("tyre.wheel.Diameter").
However, if you wanted to get the same Diameter Value Property when executing the script in the Tyre Block, the script should be self.get("wheel.Diameter").
Note that when executing scripts directly in the simulation Console pane, the context is the currently selected element in the Variables pane. So even if the simulation context is the Car Block, selecting the wheel Part Property in the Variables pane allows you to access the Diameter Value Property directly, as shown below.
It is easy to access elements that are deeper in the hierarchy tree, but accessing parent elements is more complicated. Therefore, it is important to plan where executing a particular script would be the most efficient. |
To learn more, refer to the following topics:
Additional resources