Editing a Script

You can edit a script in the Modelica Script Editor.


Before you begin: The script must be displayed and active in the Modelica Script Editor.
See Also
About Scripting
  1. If not open, from the Behavior Tools section of the action bar, click Modelica Script Editor to open a Modelica Script Editor.

    Tip: You can also access this command from the Simulation section of the action bar.

    The Modelica Script Editor appears.

    Note: The tabs in the Modelica Script Editor allow you to have several scripts opened at the same time, but only one is active, the one you see displayed in the pane.
  2. Open a script or create a scriptOpen a script or create a script.
    The script to edit is displayed in a tab.
  3. Edit the script.

    Tip: A number of features are available for editing:
    • You can use code completion when typing text; by Ctrl+Space you get possible alternatives to select from, including new defined variables not yet syntactically checked.
    • You can insert new function calls, and edit existing ones, by dedicated commands.
    • You can insert the currently displayed plots as script commands by the context menu command Insert Current Plot Commands. This makes it easy for you to recreate the plots later.
    • You can cut, copy, paste, find and replace, and go to a certain line using context menu commands.
    • You can comment out a section of the code in the script: select it, right-click and select Comment Selection - now it is not executed. To activate the code again, select it, right-click and select Uncomment Selection.
    • You can insert types and insert statements, the latter helps you to get the proper structure of statements like if ... then ... else.
    • You can test a certain part of the script by running that separately. See Executing a Script or a Selected Part of a Script.
    • You can trace global variables, function calls and variables in a function call. See Tracing.

    The script is edited; a star in the tab indicates that the changes are not saved.
  4. To test the script, you can execute the whole script, or a part of it. See Executing a Script or a Selected Part of a Script.
  5. Save the result. See Saving a Script.