For the element <wizard>, the required attributes are
name, version, and
context. In this wizard example, the attribute
name is set to ProjectWizard. The
attribute <context> is set to Project.
The optional attributes are icon and
description.
The attribute
iconspecifies the filename of the image to display as the icon for the wizard: wizard_icon. Any image file specified for use as an icon must be placed in the folder declared for images in the element<interface>for the extension. The child element<images>specifies the folder name.The attribute
descriptionspecifies the text to display in the About window for the extension when it is accessed from the Extension Manager and in the About window for the wizard when it is accessed from the Wizards page.
Note: For a mixed wizard, the attribute context is set to
Project. A mixed wizard can only be executed from the
Project tab in Workbench.
Step Definition
You use the element <step> to define a step in the
wizard. The wizard ProductWizard has six steps:
Geometry, Mechanical,
Fluent, ReportView,
CustomStep, and Charts.
Required attributes for the element <step> are
name and version. The optional
attribute caption sets the display text for the step.
You only need to set the attribute context if the context for
the step differs from the context for the wizard. Because all six steps in the wizard
ProjectWizard are executed from the Workbench
Project tab, the attribute context does
not have to be set.
Note: For a mixed wizard, the attribute context is set to the
Ansys product from which the step is executed.
Additional optional attributes can be defined for steps. For example, the attribute
HelpFile can specify an HTML file with custom help to display for the step.
The attribute enabled specifies whether to show or hide the
step. This attribute is set to true by default.
In the IronPython script, you can programmatically change the state of the attribute
enabled to create branches where certain steps are executed in
only specific circumstances: step.Enabled = True or
step.Enabled = False.
Consequently, when the wizard is executed, the choices made in the step determine which subsequent steps display.
Callback Definition
Each step defined in the XML file can have multiple callbacks invoking functions
defined in the IronPython script. You use the element
<callbacks> to define the callbacks for a step. Each
callback receives the current step as a method argument.
The required callback
<onupdate>is invoked when is clicked to move to the next wizard step.The callback
<onrefresh>is invoked when the next step is initialized. It initiates changes to the interface, so you can use this callback to change the appearance of the wizard, initialize a value to use in the current step, instantiate variables, access data of an existing project, and so on.The callback
<onreset>resets the state of the step so that a step completed incorrectly can be corrected.
A summary follows of the callbacks for the steps in the wizard
ProductWizard:
For the step
Geometry, the callback<onupdate>executes the functionEmptyAction. The callback<onreset>executes the functionDeleteGeometry. The callback<oninit>executes the functionInitTabularData.For the step
Mechanical, the callback<onupdate>executes the functionEmptyAction. The callback<onreset>executes the functionDeleteMechanical.For the step
Fluent, the callback<onrefresh>executes the functionCreateDialog. The callback<onupdate>executes the functionEmptyAction. The callback<onreset>executes the functionEmptyReset.For the step
ReportView, the callback<onrefresh>executes the functionRefreshReport. The callback<onreset>executes the functionEmptyReset.For the step
CustomStep, the callback<onrefresh>executes the functionRefreshMechanical. The callback<onupdate>executes the functionLogReport. The callback<onreset>executes the functionEmptyReset.For the step
Charts, the callback<onrefresh>executes the functionRefreshCharts.
Functions can also be executed by callbacks within property definitions for steps.
Tip: In IronPython scripts, functions can use Ansys journaling and scripting
commands. You can paste commands obtained from a session journal file—either
from the temporary journal stored in your folder %TEMP% or
from a journal generated by using the menu
option—and then edit these commands.
Property Definition
You use the element <propertygroup> to define a group of
properties within a step. You use the element <property> to
define a property and its attributes. For a property requiring validation, the callback
<onvalidate> executes the appropriate validation
function.
For the element <property>, required attributes are
control and name. The attribute
control specifies the property type. Standard property types
are select, float,
integer, scoping,
text, and fileopen. Advanced property
types such as applycancel and custom are
also supported.
Optional attributes can be defined for various properties.
The attribute
captionspecifies the display text for the property.The attribute
unitspecifies the units for a property value.The attribute
readonlyspecifies whether a property value can be edited.The attribute
defaultspecifies a default property value.The attribute
visibleonspecifies whether a property is to display. In this example, the propertyvisibleonis used to control the display of conditional options in a property group.
In the wizard ProjectWizard, the step
Geometry includes multiple occurrences of the element
<propertygroup>. The first is named
definition. Because the attribute
control is not defined, this property group lists properties
individually. Embedded with this property group is a second property group named
myselect. It sets the attribute control
to select, which provides a drop-down list:
The attribute
optionsdefines the available options.The attribute
visibleonindicates that the properties in the group are conditional based on selection from the drop-down.
The step Geometry also includes the element
<propertytable>, which creates a table for the entry of
property values in tabular format. The properties Temperature and
Pressure are nested inside the element
<propertytable> to create columns for data entry. For
information on entering tabular data, see Entering Data in a Wizard.