Data Names

Data names are used to access data from the HyperWorks Desktop database. A data name is a string that represents a piece of data. They are basically generic references to the information that physically defines an entity in the HyperWorks Desktop environment.

An example of this would be the x, y, and z coordinates that define a node’s location in three-dimensional space. This information is part of the entity’s definition and is consistent for all solvers. These data names are well documented.

Data names are accessed using the hm_getvalue command.

The command will return a value that is either a string or a numeric value, depending on the flag and the value stored in that field or data name.

An example is a Tcl script that prompts the user to select nodes and displays their x, y and z coordinates:
hm_markclear nodes 1
*createmarkpanel nodes 1
set nodes [hm_getmark nodes 1]
if { ! [ Null nodes ] } {
   foreach node $nodes {   
      set xVal [hm_getvalue nodes id=$node dataname=x]
      set yVal [hm_getvalue nodes id=$node dataname=y]
      set zVal [hm_getvalue nodes id=$node dataname=z]
      tk_messageBox -message "Node $node = $xVal $yVal $zVal"
Another example is a command that retrieves the x component of a force of ID 12 defined in the global system:
set force_x [hm_getvalue loads id=12 dataname=comp1]

Note in both scripts that to assign the return value from the command to a variable, the command is placed within square brackets.

Looking at the several of the data names for force loads:
When a load is applied to a node, this serves as a pointer to the node
x component of the vector
y component of the vector
z component of the vector
Magnitude of the load vector
Collector that owns the load (load collector pointer)

Notice that several of the data names are defined as pointers. A pointer is used to directly access another data name. For example, the collector and node data names for force loads are pointers. This means they "point" to the data names available for either collectors or nodes. In order to retrieve any data from a pointer, the data name requested for the particular pointer must also be supplied. The additional data names are separated by a period or dot (.).

To retrieve the node that load 12 is applied to:
set node_id [hm_getvalue loads id=12]
To retrieve the y coordinate of the node that load 12 is applied to:
set node_id [hm_getvalue loads id=12 dataname=node.y]
To retrieve the load collector name that contains load 12:
set loadcol_name [hm_getvalue loads id=12]

All data names for that particular entity are available for reference when using pointers.

For the collector name, notice the flag value is set to 1 when the expected return value is a string value as opposed to a numeric value.

Another example is with component collectors. There is no data name associated with a component collector to get the material name, only the material ID:
set matID [hm_getvalue comps id=12 dataname=materialid]
A second command would then be required to get the name of the material with that ID:
set matName [hm_getvalue mats id=$matID dataname=name]
Alternatively, the component collector has a material pointer data name. From this pointer, any valid material data name can be substituted by separating the pointer and the new data name with a period (.). From the example above:
set matName [hm_getvalue comps id=12]
If a command is run on a pointer without the proper specification, HyperWorks Desktop issues the error message field statement references a pointer. An example is:
set matName [hm_getvalue comps id=12 dataname=material]

HyperWorks Desktop can’t output the correct value because material points to a material entity that has many different printable values. To print the material name, reference the pointer as "". Again, a period separates the data name material and the data name name.