Working with the Editor

The Editor appears in the top panel of the Mechanical Scripting view.

 

Toolbar

The toolbar for the Editor provides several buttons:

 

  1. New Script: Clears the name, description, and script boxes, providing you with a new script template in which to work.

  2. Open Script: Opens a script, which is any Python file (*.py), from disk.

  3. Save Script (Ctrl+S)/Save Script As: Save your script to disk.

  4. Run Script: Executes the script contained in the pane.

  5. Start Debugger: This runs the script in debug mode. See the Debugging section for more information.

  6. Start Recording: Automatically create APIs by recoding the actions that you take. For example, inserting a load or a result. This option also includes a drop-down menu where you can select to active the Camera and/or Graphics filters. See descriptions for these options in the Default Settings topic below.

  7. Insert Snippet (Ctrl+I): Open the snippet inserter. This option includes a drop-down menu for the Promote Script to Snippet and Open Snippet Editor options. Both of the options open the Snippet Editor. For the promotion option, certain fields are automatically completed in the Editor.

  8. Show Button Editor: Opens the Button Editor. This option includes a drop-down menu with the option Promote Script to Button that opens the Button Editor with certain fields automatically completed using the information from the script in the Editor. For more information, see Creating User-Defined Buttons in the Mechanical User's Guide.

  9. Default Settings: Display the Default Settings dialog (see below). This dialog enables you to specify the default settings for recording and what is displayed of the Shell pane.

  10. Help: Displays a list of keyboard shortcuts.

Name and Description Area

As illustrated, there is a field for your script's name. The default is simply "New Script #." Select the field to specify a name. Using the down arrow option, you can display a pane in which you add a description for the script.

   

Content Area

The content area is where you write scripts, such as the example Pressure illustrated below.

 

The content area provides autocompletion and the following shortcuts:

  • Ctrl + f: Opens the find and replace dialog box.

  • Ctrl + F5: Executes the script.

  • Ctrl + i: Opens the snippet inserter.

Script Tabs

A script "Tab" displays at the bottom of the pane. You can now work on multiple scripts at the same time using tabs. You add new tabs using the + button and delete tabs using the x button that displays when you hover over a tab. When you open a new script, it will now open in a new tab. When you have multiple tabs, you can switch between scripts.

 

Default Settings

Selecting the Default Options button displays the following dialog.

Settings include:

  • Camera: Selecting this option enables you to capture all movements (pan/rotate) made on the model in the Geometry window are recorded.

  • Graphics: Selecting this option enables you to capture certain Graphical Toolbar options and display features while recording. Examples include turning the ruler on and off, creating Section Planes, and selecting the Thick Shells and Beams options.

  • Auto Scroll: As entries or recordings are made in the script pane, the pane automatically scrolls as new content is added.

  • Comments: Selected by default, unchecking this option turns off the automatic comments (green text) that are added for each API entry or recording.

See the Working with the Shell section for a description of the Shell filters provided via the dialog. These same filters are available from the Shell pane Shell Content Filter option.