Task Manager XML Attributes

Attributes

The basic item in the XML file is the process item. The process item contains the task items, which can be divided into one or more category items. A task can also have property items (GUI widgets) which are different parts of the task. The properties can also be divided into one or more categories.

Attributes for All Items

eeposition
Docks or undocks the task dialogs. Valid values are undocked and panel.
enabled
The task can be executed in the Task Manager.
Default is True.
help
Text for the tool tip.
helpdocument
Documentation that opens when clicking .
image
For properties, this is only valid for the action button.
label
The name of the process.
tag
Unique item identifier.
visible
Defines if the item is visible. Default is True.

Process Item Attributes

processloadprecommand
The command that runs before the Task Manager is populated.
If the command returns any of 0, '0', False, 'false', or 'False', the Task Manager will not be populated.
processloadpostcommand
The command that runs after the Task Manager is populated.
saveonclose
Prompts you to save the Task Manager session XML file when the session is closed.
sessionsaveprecommand
The command that runs before the session is saved.
In the example, this function prints in the Python window the s=<path_of_new_session_file>, p=<original_xml_path>, and a Boolean value if the session file exists already.
sessionsavepostcommand
The command that runs after the Task Manager session is saved.
title
The name of the Task Manager browser tab.
Example code for the process block:
<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 Attributes

active
If True, the task is active and can be executed.
When set to False, the task cannot be run and it is greyed out in the Tasks Browser.
The attribute's status is indicated by the check box in the Active column (hidden by default).
applybuttonstate
Sets the state of the Apply button for the task. When set to False, the Apply button is disabled. By default, the Apply button is enabled (True). Click Apply to perform the task's action.
command
Takes the values of the task properties and performs an action.
The Python command that runs upon clicking Apply.
Every task needs a command attribute that runs when you apply the task.
precommand
Defines a command that is executed when the task is selected in the Task Manager browser.
The command that runs upon starting a task.
postcommand
Defines a function that is executed after the task is applied and Task Manager proceeds to the next task.
The command that runs upon ending a task.
xml
The name of task XML file.

Attributes for Task Properties

displaytype
Defines the GUI widget.
Supported types include:
  • string
  • integer
  • unit
  • real
  • boolcheck/boolint
  • combobox
  • fileopen
  • filesave
  • choosedir
  • actionbutton
  • info – read only text
  • hm_multiselector - Returns a Collection object with HyperMesh entities via setcommand.
  • hm_multiselectorlist - Returns a list of HyperMesh entity objects via setcommand.
  • hm_planeselector - Returns a dictionary with the selected plane details (plane base, plane normal) via setcommand (available in HyperMesh).
  • hm_singleselector - Returns a HyperMesh entity object via setcommand.
  • hv_multiselector - Returns a HyperView Collection object via setcommand.
  • hv_multiselectorlist - Returns a list of HyperView entity objects via setcommand.
  • hv_singleselector - Returns a HyperView entity object via setcommand.
Note: All "selector" GUI widgets permit you to select objects/entities interactively in the modeling window.
followupdatecommand
This command is executed after setcommand if setcommand returns 1 (integer) or “1” (string). If setcommand is not defined, then followupdatecommand is executed by default.
followupdatecommand does not run upon loading the Task Manager process XML file, even if setcommand has been executed and returned a 1 or “1”.
getcommand
This command is run upon entering a task and sets its return value to the corresponding property. This is typically used in conjunction with setcommand
getvaluelistcommand
Gets valuelist by the Python command.
  • For lists, you can return list, tuple or string according to the valuelist description.
setcommand
The command that runs when setting a value in the GUI.
  • This is typically used in conjunction with getcommand.
  • Its main purpose is to pass the value to the business logic (Python code). Upon loading the process XML file, this command runs for each property that has a value defined in the XML file.
    Note: Not running for actionbutton and entity selectors, since the setcommand has a slightly different meaning here.
  • For displaytype="actionbutton", setcommand is the command that runs when you click the button.
  • For displaytype="hm_multiselector" (and other selectors, respectively), setcommand does not run upon loading the Task Manager file. The purpose of setcommand is to pass the collection object to the custom Python code, which in the case of hm_multiselector is not the same as the value. The value is the default entity type; this value is saved in the XML file.
validatecommand
Validates the input. For example, it can reference a function that checks the length of the string inserted in the GUI and trims the extra characters.
value
The current value of the property.
The value that is displayed.
valuelist
The list for the combobox, entity selector, and file types for opening a file.
String format.
  • Lists: “item1, item2, …”
  • File types, string as per the open file definition
  • Example: "HyperMesh files (*.hm);All Files (*)"
Example code for task attributes and task properties:
<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>

Script Substitutions

%T
Item tag
%V
Value
%S
Session file (saved XML file)
%P
Task Manager file (the original XML file)

Special Behavior for Display Types

actionbutton
setcommandattribute: The command activated by the button.
image: The image of the button.
All selector display types (for example: hm_multiselector, hm_singleselector, hv_multiselectorlist, and so on)
setcommand is required to return the respective object/data returned by the selector.
  • The %V used as the argument gets the object (Collection, list of entities, entity object, dictionary with plane details, and so on) as input to setcommand.
value is the primary entity type.
valuelist/getvaluelistcommand is the list of entity types that can be selected.
Note: The value or valuelist/getvaluelistcommand options are not required for displaytype="hm_planeselector" where the value is predefined to "Plane".