Event Callback Scripting

Event Callback scripting allows you to define custom JavaScript and VBScript routines that will run automatically after detecting a triggering event, such as placing a component or running a simulation. When defining an Event Callback script, specify one or more scripts that will be run after a particular event is detected.

A callback script can only access functions and other scripts defined by its callback definition. For example, a Simplorer callback script can call PropHost.GetValue — and all other PropHost functions — but only from scripts defined in the Property Dialog callback. As a result, "PropHost" is a Simplorer script item that is only visible in "Property" callback scripts. For more information, see Callback Scripting Using PropHost Object and Callback Scripting Using CompInstance Object.

The following table lists allowable callback events, items that are visible from the associated callback script, and the set of accessible functions that can be called.

Callback Event

Scripts Visible from the
Event Callback Script

Functions Callable
from the Visible Script

Place Component

CompInstance

CompInstance.GetParentDesign() — Returns a oDesign item that can be used to call Design functions.

 

CompInstance.GetPropserverName() – Returns a CompInstance identification name that can be used in oEditor property-method scripts, such as GetPropertyValue(), SetPropertyValue(), etc.

 

CompInstance.GetComponentName() — Returns the component name, e.g. "MS_TRL".

Simulate Component

CompInstance

CompInstance.GetDesign() — Returns the interface to the specified design simulation.

 

CompInstance.GetProgress() – Returns the completion percentage (from 0 to 100) of the specified design simulation.

 

CompInstance.GetRunStatus() — Returns the status number of the specified design simulation.

 

CompInstance.Abort() — Aborts the specified design simulation.

The function, ExecuteAnsoftScript(<ScriptName>), searches the configured Ansys Electronics Desktop script libraries by name for the script passed to it, and invokes the found ScriptName. The invoked script will run with the same set of visible script items as the originally called script. That is, CompInstance is visible from the invoked sub-script, ScriptName, and CompInstance’s functions can be called from ScriptName.