Using Templates for Property Creation

A template represents a generic method for defining a group of properties for an associated callback. You can create a template to provide services that can be integrated into any extension. For example, you can build a template to generate a property that displays all available coordinate systems for the current model, allowing you to select between them. You can also enrich the templates currently integrated in ACT to effectively customize environments.

The directory ANSYS_INSTALL_DIR\Addins\ACT\templates contains folders for various Ansys products. Each folder contains a single XML file with one or more templates, each of which is assigned a name. For example, the folder Mechanical contains the file controltemplates.xml, which contains templates for scoping, opening a file, and selecting a component, geometry, entity, coordinate system, and custom unit.

The template coordinatesystem_selection follows. It uses the class SelectCoordinateSystem, which is defined in the file select.py. This Python file is located here: ANSYS_INSTALL_DIR\Addins\ACT\libraries\Mechanical\templates. To link a template to a property, in its attributes, you set control to the name of the template.

</controltemplate>
    <!-- Coordinate System Selection -->
-<controltemplate version="2" name="coordinatesystem_selection">
    <property name="selectCoordinateSystem" class="templates.select.SelectCoordinateSystem" control="select"/>
</controltemplate>


Note:  A template must be made of one single property. If several properties are to be defined, you must integrate them into a group.


For more information about the templates for an Ansys product, go to its folder in ANSYS_INSTALL_DIR\Addins\ACT\templates and open its XML file. For example, for more information about Mechanical templates, go to ANSYS_INSTALL_DIR\Addins\ACT\templates\Mechanical and open controltemplates.xml.