Workbench tasks are exposed through Automation API wrappers in the namespace
Ansys.ACT.WorkBench.Automation.Workflows
. The project data
model returns this wrapper type:
task = ExtAPI.DataModel.Tasks[0]
The task wrapper does not store any local data. All data access and modification occur at member call time.
For the class Task
, property access is provided through a
dictionary. You access a property wrapper by name to get or set values. For example, the
Geometry component exposes the property ImportSolidBodies
. You
can access and change this property as follows:
task = ExtAPI.DataModel.Tasks[0] task.Properties[“GeometryImportSolidBodies”].Value = True
Note: ACT-defined callbacks still receive UserTasks
as
arguments. A UserTaskTemplate
is now accessible from the
property Template
. All other task functionality remains
intact.
The following table lists task APIs.
Class | Member | Description |
---|---|---|
ITask | Name | The internal task name. |
Caption | The user-visible task display text. | |
TaskGroup | The parent task group. | |
InternalObject | The task's internal object. | |
Task | TaskId | The internal Workbench component identifier. |
Caption | The Workbench UI-visible display text. | |
TaskGroup | The task group wrapper for the component's system instance. | |
InternalObject | The Workbench component. | |
SourceTasks | The list of tasks providing data to this task. | |
TargetTasks | The list of tasks consuming data from this task. | |
State | The task state. | |
Template | Gets the template from which the task was created. | |
UserId | Gets the ID to display in the UI. | |
DirectoryName | Gets the data directory name to display in the UI. | |
MasterTask | Gets the master task from which the task directly consumes shared
data. This is always the immediate upstream sharing source, even if the
sharing is full-share. For the true root data task, use
RealTask . | |
RealTask | Gets the shared data root task from which the task consumes shared data. This is always the first (original, non-grayed) sharing source if fully shared. Otherwise, it is the task itself. | |
IsSharing | Gets a value indicating whether the task is a slave of a master-sharing source. | |
Container | Gets the container for the task. | |
Notes | Gets the task notes. | |
UsedLicenses | Gets the used license for the component. This dictionary maps the license IDs to the number of used licenses for the task. | |
Solver | Gets the task solver type. | |
ImageName | Gets the name for the task icon image. | |
IsFailedState | Gets a value indicating whether the task is in a failed state from a previous data operation, such as update or refresh. | |
AlwaysBePartOfDpUpdate | Gets a value indicating whether the task should always be part of a design point update, even if it does not affect any parameter value. | |
CoupledClients | Gets the list of coupled client data tasks. | |
CoupledToTask | Gets the coupling server task (if available). | |
CoordinateId | Gets the task coordinate ID as a union of the task group letter and task index. | |
Parameters | The list of input and output parameters associated with the task. | |
Properties | Gets a dictionary of properties, accessible by property name. | |
InputData | Gets the input data, by type string key, for the task. | |
OutputData | Gets the output data, by type string key, for the task. | |
GetPropertyNames() | Gets the names of all properties declared with the task's data model. | |
ExecuteCommand(command Name,
arguments) | Executes a specific task-bound command. | |
Clean() | Deletes the heavyweight data of this task to reduce the size of the project. Heavyweight data can include the solution, results, or both. | |
Refresh() | Refreshes the input data for a task by reading all changed data from upstream (source) tasks. No calculations or updates based on this new data are performed. | |
Reset() | Resets the task by removing all user input and result data. | |
Update() | Updates the task by refreshing the input from all upstream components and then performs a local calculation based on current data. | |
Remove() | Deletes the task and all dependents from its task group. |