Custom Module Creation Process
Create and plug-in custom modules to Report.
- Tcl script that runs the functionality of the module.
- XML script that populates in the property area in the user interface
For any module to work successfully, the Tcl and XML files need to be connected and contribute their individual responsibilities properly.
For this process overview, two files will be used: CurveMaxima.xml and CurveMaxima.tcl. They are located here:
<installation_directory>/tutorials/hwdesktop/mv_hv_hg/publish_reports/CurveMaxima.xml
<installation_directory>/tutorials/hwdesktop/mv_hv_hg/publish_reports/CurveMaxima.tcl
Module Creation Process Overview
- Data preparation.
The custom script performs the necessary processes on the model or graphs and prepares it for data capture. Values and information are captured, which can be used later for Report titles, image captions, and to populate text fields and tables.
- Defining the objects and placeholders.
The Report API layer is used to create slides based on slide layouts or Word chapters. These objects contain images, text, and tables.
- Populate data.
The data prepared in step 1 is used to populate objects in step 2. The property selection for individual items is set during the item creation (step 2) or this data population step.
- Connect to the user interface.Decide the input parameters that will be required to run this module. Options include:
- Where the data exists (page and window selection, single or multiple).
- The format to present the data. For example, specific slide layout styles.
- The amount of content to add. For example, a module could have two modes: short and descriptive.
- Register the module.
Register the directory of the module scripts in one of the recommended ways.
For this example, the custom module Curve Maxima will be used. This file can be found in <installation_directory>/tutorials/hwdesktop/mv_hv_hg/publish_reports/CurveMaxima.xml
- Module Objective
- From a given HyperGraph window, identify the names and IDs of all curves, the maximum Y value, and the curve's X location in a tabular format. Capture an image that highlights the maximum points from all curves. This needs to flexible for any Word or PPT format.
Data Preparation
A set of lines (Tcl) that prepares the data is required. For this module's objective, the HyperGraph window needs to be defined to get a clean capture. This includes all curves visible and only the maximum value notes created. Also, the values of the maximum Y and its equivalent X need to be found for each curve ID and label.
The CurveMaxima.tcl file can be found in <installation_directory>/tutorials/hwdesktop/mv_hv_hg/publish_reports/CurveMaxima.tcl
Define Objects and Placeholders
Use report APIs to create slides with images, text, and tables for PowerPoint (PPT) and for Word, report and chapters with images, text, and tables.
Populate Data
The objects created above can be populated with data obtained using the user logic. The IDs of the report objects are required in this step.
Connect to the User Interface
In the Tcl script, the initialize block receives the ID and the position to be assigned to the module. Also, it takes the values set in the property area of the module in the user interface.
This initialize block is connected to the XML file and shares information from property area of the module.
You can edit the template CurveMaxima.xml to change the hierarchy in the property area. It can also be edited to change the selection styles from combo box to multi-selector. Basic functions, such as getting default pages and window IDs, and special instructions regarding when the Report is in PPT or Word mode, can be written in the Tcl script and referred to in the XML file.
Register the Module
After finishing these steps, please place the XML and Tcl file in the appropriate location, preferably in the same folder. It's recommended to test this module in a HyperWorks session. For this, the module needs to be registered. This can be done in one of the following ways: