Task Manager
Use the Task Manager to load an XML file that defines tasks and their attributes.
XML Example
The XML file contains information to constructs the process tree and the dialogs for the individual tasks.
Some of the XML attributes use functions from the Python code to execute the tasks.
Another component of the process is the Python file that contains all callback functions that are called by the different tasks in the defined XML file. These functions can be commands that execute a specific task, commands that are applied before or after the tasks, and so on. The information defined in the XML file and the Python code are “linked” using the Task Manager Python API (hw.taskmanager module) which provides classes and functions to help you navigate, select, customize, and apply tasks. The Python code can be organized in multiple files to make the code more readable and better structured.
<root>
<process label="Pre Process SETGET"
tag="preprocess"
title="TM Example 1"
saveonclose="False"
helpdocument="tmexample1HELP.pdf"
eeposition="undocked"
processloadprecommand="task_tmexample1_setget.preload(%S, %P)"
processloadpostcommand="task_tmexample1_setget.postload(%S, %P)"
sessionsavepostcommand="task_tmexample1_setget.postsave(%S, %P)"
sessionsaveprecommand="task_tmexample1_setget.presave(%S, %P)">
<task label="Config"
tag="config"
command="task_tmexample1_setget.applyConfig()"
applybuttonstate="Enabled">
<category tag="cat_process" label="Process">
<property label="Working directory"
tag="workingdir"
displaytype="choosedir"
getcommand="task_tmexample1_setget.getWorkDirectory()"
setcommand="task_tmexample1_setget.setWorkDirectory(%V)" />
<property label="Description"
tag="description"
displaytype="string"
help="Max number of characters: 25"
validatecommand="task_tmexample1_setget.validateDescription(%V)"
setcommand="task_tmexample1_setget.setValue(description, %V)"
getcommand="task_tmexample1_setget.getValue(description)" />
</category>
<category tag="config_hm" label="HM file">
<property label="Select file"
tag="btn_selectfiles"
help="custom image"
displaytype="actionbutton"
image="toolbarFileOpenStrip-16.png"
setcommand="task_tmexample1_setget.selectHMFiles()"/>
<property label="HM file"
tag="config_hmfile"
enabled="True"
displaytype="fileopen"
getvaluelistcommand="task_tmexample1_setget.getHMFileTypes()"
setcommand="task_tmexample1_setget.setValue(hmfile, %V)"
getcommand="task_tmexample1_setget.getValue(hmfile)"
help="Select an hm file"/>
</category>
<category tag="cat_config_trans" label="Translate">
<property label="Direction"
tag="config_transdir"
displaytype="combobox"
value="x"
getcommand="task_tmexample1_setget.getValue(transdir)"
getvaluelistcommand="task_tmexample1_setget.getValueList(transdir)"
setcommand="task_tmexample1_setget.setValue(transdir, %V)"/>
<property label="Distance (integer)"
tag="config_transdist"
displaytype="integer"
getcommand="task_tmexample1_setget.getValue(transdist)"
setcommand="task_tmexample1_setget.setValue(transdist, %V)"/>
</category>
<category tag="config_cat_mesh" label="Mesh">
<property label="Mesh size"
tag="config_meshsize"
displaytype="real"
value="0.6"
validatecommand="task_tmexample1_setget.validateMeshSize(%V)"
setcommand="task_tmexample1_setget.setValue(meshsize, %V)"
getcommand="task_tmexample1_setget.getValue(meshsize)" />
</category>
<category tag="config_export" label="Export">
<property label="File path"
tag="config_optistructfile"
displaytype="filesave"
getvaluelistcommand="task_tmexample1_setget.getOptistructFileTypes()"
setcommand="task_tmexample1_setget.setValue(optistructfile, %V)"
getcommand="task_tmexample1_setget.getValue(optistructfile)" />
</category>
</task>
<category tag="cat_tasks" label="Task" expand="True">
<task label="Open HM file"
tag="import_hm"
command="task_tmexample1_setget.importHM()"
help="select hm file and open"
precommand="task_tmexample1_setget.preEnter()"
postcommand="task_tmexample1_setget.postRunTask(%T)"
>
<category tag="task_cat_hm" label="HM file">
<property label="Select file"
tag="btn_hm_selectfiles"
displaytype="actionbutton"
setcommand="task_tmexample1_setget.selectHMFiles()"/>
<property label="HM file"
tag="task_hmfile"
enabled="True"
displaytype="fileopen"
getvaluelistcommand="task_tmexample1_setget.getHMFileTypes()"
setcommand="task_tmexample1_setget.setValue(hmfile_1, %V)"
getcommand="task_tmexample1_setget.getValue(hmfile_1)"
help="Select an HM file"/>
</category>
</task>
<task label="Renumber Components"
tag="renumber"
help="Renumber all component from 1"
enabled="True"
command="task_tmexample1_setget.renumberComps()"
postcommand="task_tmexample1_setget.postRunTask(%T)"/>
<task label="Translate"
tag="translate"
enabled="True"
command="task_tmexample1_setget.translate()"
postcommand="task_tmexample1_setget.postRunTask(%T)">
<property label="Direction"
tag="transdir"
displaytype="combobox"
value="x"
getcommand="task_tmexample1_setget.getValue(transdir)"
getvaluelistcommand="task_tmexample1_setget.getValueList(transdir)"
setcommand="task_tmexample1_setget.setValue(transdir, %V)"/>
<property label="Distance (integer)"
tag="transdist"
displaytype="integer"
getcommand="task_tmexample1_setget.getValue(transdist)"
setcommand="task_tmexample1_setget.setValue(transdist, %V)"/>
</task>
<task label="Create mesh"
tag="mesh"
command="task_tmexample1_setget.mesh()"
help="Mesh selected surface or component"
enabled="True"
postcommand="task_tmexample1_setget.postRunTask(%T)">
<category tag="cat_mesh" label="Mesh">
<property label="NumSelectedSurfs"
tag="numselcompmesh"
displaytype="info"
getcommand="task_tmexample1_setget.getValue(numselcompmesh)" />
<property label="Select surfaces"
tag="selcompmesh"
displaytype="hm_multiselector"
getcommand="task_tmexample1_setget.getValue(selcompmesh)"
getvaluelistcommand="task_tmexample1_setget.getValueList(selcompmesh)"
setcommand="task_tmexample1_setget.setSurfsOrCompsToMesh(%V)"/>
<property label="Mesh size"
tag="task_meshsize"
displaytype="real"
getcommand="task_tmexample1_setget.getValue(meshsize)"
setcommand="task_tmexample1_setget.setValue(meshsize, %V)"/>
</category>
</task>
<task label="Export"
tag="export"
command="task_tmexample1_setget.export()"
enabled="True"
postcommand="task_tmexample1_setget.postRunTask(%T)"
>
<property label="File path"
tag="task_optistruct"
displaytype="filesave"
getvaluelistcommand="task_tmexample1_setget.getOptistructFileTypes()"
setcommand="task_tmexample1_setget.setValue(optistructfile, %V)"
getcommand="task_tmexample1_setget.getValue(optistructfile)"/>
</task>
</category>
</process>
</root>