Snippets

Snippets are existing lines of code that can quickly and easily be inserted in the command line, saving you from repetitive typing. As you use the ACT Console, you can insert any of the snippets that ANSYS supplies for ACT-specific commands. Additionally, you can begin building your own library of snippets to either supplement or replace the supplied snippets with your own custom snippets.

 

The ExtAPI snippet inserts ExtAPI. in the command line, providing you with immediate access to the API. From the autocomplete options in the tooltip, you can then begin selecting additional attributes to build your command.

The Snippet Template snippet provides sample code for swapping two variables. The comments explain how a snippet can contain editable fields, which are automatically selected for modification when the snippet is inserted. When a field is selected, you can type a new value to override the default value or let the default value remain. Pressing the Tab key moves the cursor to the next editable field.

The Helpers folder provides snippets for frequently used commands. Descriptions follow of all snippets in this folder:

Lastly, the Examples folder provides snippets that you can use as templates. For example, the Add Pressure Template snippet shows how to create a pressure on the first face of the first body of the first part.

To see all snippets, including those predefined for standard Python commands, you can press Ctrl + space when nothing is entered in the command line and then scroll through the autocompletion suggestions, which includes both variables and snippets. Although you can remove snippets for ACT-specific commands by deleting them from the Snippets panel, you cannot delete the snippets predefined for standard Python commands. For more information, see Using Snippets.


Release 18.2 - © ANSYS, Inc. All rights reserved.