HWAT

In addition to the HyperMesh Tcl commands, the HyperWorks Automation Toolkit (HWAT) is provided. This toolkit provides a collection of functions and widgets that allows you to quickly assemble HyperWorks automations with minimal effort and maximum portability.

It is easy to access the HWAT functions from Tcl scripts. Simply add the following line inside the namespace definition or directly inside the procedure in your script:
package require hwat;

This command indicates to Tcl that the HWAT package should be available inside the script. Once the package is loaded, the commands are available. All HWAT commands belong to the ::hwat namespace and must be called as such.

There are 7 categories of HWAT functions, of which one is specific to Tk and the other 6 are for general Tcl usage. These categories are:
  • Core Function: Primarily helper functions and are not used directly in most cases. They are usually called from within other functions.
  • I/O Functions: Provide assistance for working with files.
  • Math Functions: Provide for vector and matrix math calculations.
  • Solver Functions: Provide automations for solver specific operations aimed at setting up crash models.
  • Utility Functions: Functions for performing commonly required automations.
  • Widget Functions: Tk functions to create widgets.
  • XML Functions: Use a SAX-based parser and provide functionality for working with XML files.

Each of these function categories have a namespace associated with them, underneath the ::hwat namespace. For example, to call the I/O function CloseFile, the syntax used is ::hwat::io::CloseFile. Similar namespaces exist for the other categories.

An example of a procedure that uses an HWAT command to find an angle between two vectors and return the value in a popup window:
proc GetAngle { vect1 vect2 } {
    package require hwat;

    set angle [::hwat::math::AngleBetweenVectors $vect1 $vect2];
    tk_messageBox -message "The angle between the vectors is $angle";
}

GetAngle [list 1.0 2.0 3.0] [list 4.0 5.0 6.0]