The mixed wizard BridgeSimulation
executes one step in the
Workbench Project tab, runs the wizard
CreateBridge
in either DesignModeler or SpaceClaim, runs the
wizard SimpleAnalysis
in Mechanical, and then returns to the
Project tab to execute the step
Results
.
An excerpt from the file WizardDemos.xml follows. Code is
omitted for the element <uidefinition>
and all wizards other
than the mixed wizard BridgeSimulation
.
<extension version="2" minorversion="1" name="WizardDemos"> <guid shortid="WizardDemos">7fdb141e-3383-433a-a5af-32cb19971771</guid> <author>Ansys, Inc.</author> <description>Simple extension to test wizards in different contexts.</description> <script src="main.py" /> <script src="ds.py" /> <script src="dm.py" /> <script src="sc.py" /> <interface context="Project|Mechanical|SpaceClaim"> <images>images</images> </interface> <interface context="DesignModeler"> <images>images</images> <toolbar name="Deck" caption="Deck"> <entry name="Deck" icon="deck"> <callbacks> <onclick>CreateDeck</onclick> </callbacks> </entry> <entry name="Support" icon="Support"> <callbacks> <onclick>CreateSupport</onclick> </callbacks> </entry> </toolbar> </interface> <simdata context="DesignModeler"> <geometry name="Deck" caption="Deck" icon="deck" version="1"> <callbacks> <ongenerate>GenerateDeck</ongenerate> </callbacks> <property name="Length" caption="Length" control="float" unit="Length" default="300 [m]" /> <property name="Width" caption="Width" control="float" unit="Length" default="20 [m]" /> <property name="Beams" caption="Beams" control="integer" default="31" /> </geometry> </simdata> <simdata context="DesignModeler"> <geometry name="Support" caption="Support" icon="support" version="1"> <callbacks> <ongenerate>GenerateSupport</ongenerate> </callbacks> <property name="Length" caption="Length" control="float" unit="Length" default="300 [m]" /> <property name="Height" caption="Height" control="float" unit="Length" default="100 [m]" /> <property name="Width" caption="Width" control="float" unit="Length" default="20 [m]" /> <property name="Number" caption="Number" control="integer" default="3" /> </geometry> </simdata> ... <wizard name="BridgeSimulation" version="1" context="Project" icon="bridge"> <description>Simple wizard for mixed wizard demonstration.</description> <step name="Project" caption="Create Project" version="1" context="Project" HelpFile="help/prj1.html"> <description>Create a static structural analysis.</description> <callbacks> <onupdate>CreateStaticStructural</onupdate> <!--<onreset>DeleteStaticStructural</onreset>--> </callbacks> <property name="Name" caption="system name" control="text" /> <property name="Context" caption="geometry context" control="select"> <attributes options="DesignModeler,SpaceClaim"/> <callbacks> <onvalidate>OnSelectContext</onvalidate> </callbacks> </property> </step> <step name="DeckDM" caption="DeckDM" version="1" context="DesignModeler" HelpFile="help/dm1.html"> <description>Create the deck.</description> <callbacks> <onupdate>UpdateDeck</onupdate> </callbacks> <propertygroup display="caption" name="Deck" caption="Deck Definition" > <property name="Length" caption="Length" control="float" unit="Length" default="300 [m]" /> <property name="Width" caption="Width" control="float" unit="Length" default="20 [m]" /> <property name="Beams" caption="Beams" control="integer" default="31" /> </propertygroup> </step> <step name="SupportsDM" caption="SupportsDM" context="DesignModeler" enabled="true" version="1" HelpFile="help/dm2.html"> <description>Create supports.</description> <callbacks> <onupdate>UpdateSupports</onupdate> </callbacks> <propertygroup display="caption" name="Supports" caption="Supports Definition" > <property name="Height" caption="Height" control="float" unit="Length" default="100 [m]" /> <property name="Number" caption="Number" control="integer" default="3" /> </propertygroup> </step> <step name="DeckSC" caption="DeckSC" version="1" context="SpaceClaim"> <description>Create the deck.</description> <callbacks> <onupdate>UpdateDeckSC</onupdate> </callbacks> <propertygroup display="caption" name="Deck" caption="Deck Definition" > <property name="Length" caption="Length" control="float" unit="Length" default="300 [m]" /> <property name="Width" caption="Width" control="float" unit="Length" default="20 [m]" /> <property name="Beams" caption="Beams" control="integer" default="31" /> </propertygroup> </step> <step name="SupportsSC" caption="SupportsSC" context="SpaceClaim" enabled="true" version="1"> <description>Create supports.</description> <callbacks> <onupdate>UpdateSupportsSC</onupdate> </callbacks> <propertygroup display="caption" name="Supports" caption="Supports Definition" > <property name="Height" caption="Height" control="float" unit="Length" default="100 [m]" /> <property name="Number" caption="Number" control="integer" default="3" /> </propertygroup> </step> <step name="Mesh" caption="Mesh" version="1" context="Mechanical" HelpFile="help/ds1.html"> <description>Setup some mesh controls.</description> <callbacks> <onreset>RemoveControls</onreset> <onupdate>CreateMeshControls</onupdate> </callbacks> <propertygroup display="caption" name="Sizing" caption="Mesh Sizing" > <property name="Location" caption="Edge Location" control="geometry_selection"> <attributes selection_filter="edge" /> <callbacks> <isvalid>IsLocationValid</isvalid> </callbacks> </property> <property name="Ndiv" caption="Divisions" control="integer" /> </propertygroup> </step> <step name="Solution" caption="Solution" version="1" context="Mechanical" HelpFile="help/ds2.html"> <description>Setup loads.</description> <callbacks> <onrefresh>RefreshLoads</onrefresh> <onreset>RemoveLoads</onreset> <onupdate>CreateLoads</onupdate> </callbacks> <propertygroup display="caption" name="Mesh" caption="Mesh Statistics" > <property name="Nodes" caption="Nodes" control="text" readonly="true" /> <property name="Elements" caption="Elements" control="text" readonly="true" /> </propertygroup> <propertygroup display="caption" name="FixedSupport" caption="Fixed Support" > <property name="Location" caption="Face Location" control="geometry_selection"> <attributes selection_filter="face" /> <callbacks> <isvalid>IsLocationFSValid</isvalid> </callbacks> </property> </propertygroup> </step> <step name="Results" caption="Results" version="1" context="Project" HelpFile="help/prj2.html"> <description>View Results.</description> <callbacks> <onrefresh>RefreshResultsProject</onrefresh> </callbacks> <property name="Res" caption="Deformation" control="text" readonly="true" /> </step> </wizard> </extension>
Understanding the elements <interface>
and
<simdata>
is necessary to understanding the mixed wizard
BridgeSimulation
.
- Wizard Interface Definition
The element
<interface>
defines two user interfaces for the extensionWizardDemos
, both of which the wizardBridgeSimulation
uses.The first element
<interface>
has the attributecontext
set toProject|Mechanical|SpaceClaim
, which indicates that wizards with their contexts set to any of these products use this interface.The second element
<interface>
has the attributecontext
set toDesignModeler
, which indicates that wizards with their contexts set to this product use this interface. This element<interface>
has a child element<toolbar>
that defines two toolbar buttons for exposure in DesignModeler. When the buttons are clicked, the callback<onclick>
executes the functionsCreateDeck
andCreateSupport
, creating a deck geometry with supports.
- Simdata Definition
The element
<simdata>
provides data. This extension has two such elements to provide data for creating the geometriesDeck
andSupport
in DesignModeler.- Wizard Definition
The element
<wizard>
namedBridgeSimulation
defines the mixed wizardBridgeSimulation
. The attributecontext
specifies the product in which the wizard is executed. Because this wizard accesses the target product from the Project tab instead of executing in the target product directly,context
is set toProject
.- Step Definition
The element
<step>
defines a step in the mixed wizardBridgeSimulation
. This wizard has eight steps:Project
,DeckDM
,SupportsDM
,DeckSC
,SupportsSC
,Mesh
,Solution
, andResults
. The steps withDM
in their names are executed in DesignModeler. The steps withSC
in their names are executed in SpaceClaim.For each step:
The attributes
name
,version
, andcaption
specify the name, version, and display text for the step.The attribute
context
specifies the Ansys product in which the specific step is executed. You only need to set the context for the step if it differs from the context for the wizard.The attribute
HelpFile
specifies the HTML file to display as the custom help for the step.The element
<callbacks>
specifies callbacks to functions defined in all four IronPython scripts referenced in this extension's XML file.For the step
Project
, the callback<onupdate>
executes the functionCreateStaticStructural
in the script main.py.For the step
DeckDM
, the callback<onupdate>
executes the functionUpdateDeck
in the script dm.py.For the step
SupportsDM
, the callback<onupdate>
executes the functionUpdateSupports
in the script dm.py.For the step
DeckSC
, the callback<onupdate>
executes the functionUpdateDeckSC
in the script sc.py.For the step
SupportsSC
, the callback<onupdate>
executes the functionUpdateSupportsSC
in the script sc.py.For the step
Mesh
, the callbacks<onreset>
and<onupdate>
execute the functionsRemoveControls
andCreateMeshControls
in the script ds.py.For the step
Solution
, the callback<onrefresh>
,<onreset>
, and<onupdate>
execute the functionsRefreshLoads
,RemoveLoads
, andCreateLoads
in the script ds.py.For the step
Results
, the callback<onrefresh>
executes the functionRefreshResultsProject
in the script main.py.