Data Entry and Access

Template files allow you to access information from the HyperWorks Desktop database with two methods, data names and attributes.

Template files use data names to access information from the HyperWorks Desktop database. A data name is a string that represents a piece of data. At output, HyperWorks Desktop replaces the data name string with the value that the data name represents. For example, a node has id, x, y, z, and system as possible data names in the template files. If you enter the command *field(integer,id,8) into a template file, HyperWorks Desktop outputs the node ID in an integer format using eight spaces.

A data name can also represent a pointer to another entity in the database. In the element data name list, the data name node1 is a pointer. node1 points to a node in the database. Using the command *field(integer,node1,8), HyperWorks Desktop issues the error message "field statement references a pointer". HyperWorks Desktop can’t output the correct value because node1 points to a node entity that has many different possible values. To print the node ID, reference the pointer as *field(integer,node1.id,8). A period separates the data name pointer node1 and the data name id.

Template files additionally use attributes to describe solver-specific data. This data is created using the HyperWorks Desktop card image system and may be attached to entities within the HyperWorks Desktop database. Attributes are defined in the HyperWorks Desktop template system by giving them unique IDs for each solver. This is done by giving each solver a number through the use of the template command *codename(). Each attribute can be accessed either through its unique ID or the name that the user gives the attribute. Attributes are defined using the *defineattribute() command. An example for the OptiStruct MAT1 material is:
*defineattribute(E,1,real,none)
*defineattribute(G,2,real,none)
*defineattribute(Nu,3,real,none)
*defineattribute(Rho,4,real,none)

The template files also allow for advanced features to be defined from within the template like counters, tables and variables. This allows information to be passed from one function to another.

Comments can be added to the template using //. Add as many comments as needed to the template file in order to describe what is being coded and to allow other developers to follow your logic.