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.
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"
}
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.
- node
- When a load is applied to a node, this serves as a pointer to the node
- comp1
- x component of the vector
- comp2
- y component of the vector
- comp3
- z component of the vector
- magnitude
- Magnitude of the load vector
- collector
- 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 (.).
set node_id [hm_getvalue loads id=12 dataname=node.id]
set node_id [hm_getvalue loads id=12 dataname=node.y]
set loadcol_name [hm_getvalue loads id=12 dataname=collector.name]
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.
set matID [hm_getvalue comps id=12 dataname=materialid]
set matName [hm_getvalue mats id=$matID dataname=name]
set matName [hm_getvalue comps id=12 dataname=material.name]
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 "material.name". Again, a period separates the data name material and the data name name.