Scripting Basic Attribute Types

Most of the Ansys Orbit Determination Tool Kit (ODTK®) application attributes are simple scalar types that have equivalents in many programming languages.

You can learn about the type in the ODTK GUI. Right-click the attribute and then click "Attribute Information." A dialog box will pop up with the attribute type and additional information such as minimum and maximum constraints or allowed enumeration choices. The discussion of each type includes the appropriate syntax for setting and getting its value. Some of the attributes are grayed out, indicating that they are read only.

This topic provides short descriptions and ODTK-related code examples (COM and Cross-platform API) for the following basic types:

Type REAL

Real attributes are for unitless real numbers. Minimum and maximum constraints may apply.

COM

Cross-Platform API

Type INT

These attributes are for integer values. Minimum and maximum constraints may apply.

COM

Cross-Platform API

Type BOOL

Boolean attributes accept values of true and false, where false = 0 and true = 1.

COM

Cross-Platform API

Type STRING

An example of a string is a "Description" field, which is available on all ODTK objects.

COM

Cross-Platform API

Type STRING ENUMERATION

This type of STRING attribute can only accept a specific predefined set of values. For instance, Filter.StartMode can only be "Initial", "Restart", or "AutoRestart".

COM

Cross-Platform API

To get the list of valid enumeration choices, right-click the attribute and open the Attribute Information dialog or use the Scripting Tool's "Props" function. Alternatively, you can retrieve the list in your script via the Choices() property.

COM

 

One special case of string enumeration is the SelectedRestartTime for a filter or simulator. The choices in this case change based on each filter or simulator run, and the choices contain a list of date and time strings with units of UTCG or GPSG. The scenario date units setting scen.Units.DateFormat determines the units. When setting the SelectedRestartTime in a script, any of the formats in the examples below will work if you do not define the units. The ODTK application assumes that the input date string is in the scenario units. If the restart time that you set is not a valid restart time, then the SelectedRestartTime will not be set.

COM

Cross-Platform API