Progress Monitoring

ACT provides progress monitoring for custom workflows via the property ExtAPI.UserInterface.ProgressMonitor. This property returns an object of type IProgressMonitor.

The following APIs are available:

ClassMemberDescription

IProgressMonitor

WorkName

The name of the current work under progress monitoring.

WorkStatus

The current status for the work under progress monitoring.

WorkDetails

The current details for the work under progress monitoring.

TotalWorkUnits

The total number of work units allocated to the work under progress monitoring.

CompletedWorkUnits

The completed number of work units.

Parent

The parent progress monitor, if this is a child monitor. Otherwise, null.

PropagateWorkStatus

Indicates whether to propagate a child’s work status up to the parent.

PropagateWorkDetails

Indicates whether to propagate a child’s work details up to the parent.

CanAbort

Indicates whether the user can cancel the current operation.

CanInterrupt

Indicates whether the user can interrupt the current operation.

BeginWork(name, units)

Starts work engaged with progress monitoring.

UpdateWork(units)

Updates the current work units.

EndWork()

Marks the current work as complete (progress at 100%).

CreateChildMonitor(units)

Creates a child progress monitor with the current monitor as its parent.

Status

The current status of this progress monitor.

ProgressStatus Enum Values:

  • NotStarted

  • Running

  • Aborted

  • Interrupted

  • Completed

A sample implementation of progress monitoring functionality follows.

def update(task):
    
    monitor = ExtAPI.UserInterface.ProgressMonitor
    monitor.BeginWork("Testing 123...", 3)
    LogProgress(monitor)
    monitor.WorkStatus = "Test Status!"
    monitor.WorkDetails = "Test Details!"
    System.Threading.Thread.Sleep(2000)
    monitor.UpdateWork(1)
    LogProgress(monitor)
    monitor.WorkDetails = "More details..."
    System.Threading.Thread.Sleep(2000)
    monitor.UpdateWork(1)
    LogProgress(monitor)
    monitor.WorkDetails = "Even more details..."
    System.Threading.Thread.Sleep(2000)
    monitor.UpdateWork(1)
    LogProgress(monitor)
    monitor.WorkDetails = "Final details..."
    System.Threading.Thread.Sleep(2000)
    monitor.EndWork()
def LogProgress(monitor):
    ExtAPI.Log.WriteMessage("Progress:  " + str(monitor.CompletedWorkUnits) 
                             + "/" + str(monitor.TotalWorkUnits))

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