Command Line Usage

In the command line, you typically begin a command by typing:

ExtAPI.

This stands for Extension API and is the gateway into the ACT API. Once you type the period (.), you are in the API. The ACT Console provides "smart" autocompletion, which means it takes syntax elements such as brackets or quotations marks into account. As you type in the command line, a scrollable list of suggestions is displayed above the command line. Each suggestion has an icon with a letter and color-coding.

See Using Autocompletion in the ANSYS ACT Developer's Guide for more information about member types and return types.

After typing ExtAPI., DataModel is one of the many member types shown in the list of suggestions. This property accesses the Mechanical tree. When you place the mouse cursor over any suggestion in the list, the tooltip provides information about it. Clicking a suggestion inserts it in the command line, where you then type any string that might be required followed by a period to see the next set of available suggestions.

 

In the command line, pressing Ctrl + ↑ gives you access to the previous command shown in the command history.

A step-by-step example follows for building a command that returns the volume for a specific part body:

Pressing Enter after constructing this command returns the volume of the first body in the GeoData hierarchy.

The next example shows how autocompletion helps you to construct the following command:

ExtAPI.DataModel.Project.Geometry.ElementControl = ElementControl.Manual

As you select the ElementControl property during command construction, the suggestion tooltip indicates that you must get or set the enumeration return type to ElementControl. Once you do this, the suggestion tooltip prompts you to select either Manual or Program Controlled.

 

While simple, these two examples demonstrate how you use the ACT Console to access information. If you understand these examples, you are well on your way to writing scripts for the Mechanical interface. Additionally, you can refer to Script Examples to see scripts for performing many different types of tasks in Mechanical.


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