Accessing Task APIs

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.

ClassMemberDescription
ITaskNameThe internal task name.
CaptionThe user-visible task display text.
TaskGroupThe parent task group.
InternalObjectThe task's internal object.
TaskTaskIdThe internal Workbench component identifier.
CaptionThe Workbench UI-visible display text.
TaskGroupThe task group wrapper for the component's system instance.
InternalObjectThe Workbench component.
SourceTasksThe list of tasks providing data to this task.
TargetTasksThe list of tasks consuming data from this task.
StateThe task state.
TemplateGets the template from which the task was created.
UserIdGets the ID to display in the UI.
DirectoryNameGets the data directory name to display in the UI.
MasterTaskGets 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.
RealTaskGets 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.
IsSharingGets a value indicating whether the task is a slave of a master-sharing source.
ContainerGets the container for the task.
NotesGets the task notes.
UsedLicensesGets the used license for the component. This dictionary maps the license IDs to the number of used licenses for the task.
SolverGets the task solver type.
ImageNameGets the name for the task icon image.
IsFailedStateGets a value indicating whether the task is in a failed state from a previous data operation, such as update or refresh.
AlwaysBePartOfDpUpdateGets a value indicating whether the task should always be part of a design point update, even if it does not affect any parameter value.
CoupledClientsGets the list of coupled client data tasks.
CoupledToTaskGets the coupling server task (if available).
CoordinateIdGets the task coordinate ID as a union of the task group letter and task index.
ParametersThe list of input and output parameters associated with the task.
PropertiesGets a dictionary of properties, accessible by property name.
InputDataGets the input data, by type string key, for the task.
OutputDataGets 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.