hm_entityinfo
Returns various information on entities.
Syntax
hm_entityinfo option entity_type ?entity_name_or_id? ?search_type?
Type
HyperMesh Tcl Query
Description
Returns various information on entities.
Inputs
- option
- Type of information requested. Valid values are:
- centroid elems entity_id
- Returns the element centroid as a list of three values {x y z}.
- color entity_type entity_name_or_id ?search_type?
- Returns the color of the entity (1-64). Only for entities that have a color.
- configtype entity_type config_name
- Supported for elements and loads. If no template is loaded, returns an empty value, otherwise returns the current type string for the specified config_name. For example:
- configtypeid entity_type config_name
- Supported for elements and loads. If no template is loaded, returns an empty value, otherwise returns the current type ID for the specified config_name. For example:
- configtypeids entity_type config_name
- Supported for elements and loads. If no template is loaded, returns an empty list, otherwise returns a list of type IDs for the specified config_name. For example:
- configtypes entity_type config_name
- Supported for elements and loads. If no template is loaded, returns an empty list, otherwise returns a list of type strings for the specified config_name. For example:
- dof entity_type entity_id
- For rbe3 elements and equations only, returns the degree of freedom flags for the independent nodes.
- elementsvisible entity_type entity_name_or_id ?search_type?
- Returns 1 if the entity is visible, 0 otherwise. For entities that have both geometry and element display states, the visibility state of elements is returned. For all other entities, the general visibility state is returned.
- exist entity_type entity_name_or_id ?search_type?
- Returns 1 if the entity exists, 0 otherwise. If a value of -1 is passed for the ID, this command will return 1 if any surface exists and 0 otherwise.
- geometryvisible entity_type entity_name_or_id ?search_type?
- Returns 1 if the entity is visible, 0 otherwise. For entities that have both geometry and element display states, the visibility state of geometry is returned. For all other entities, the general visibility state is returned.
- geomstyle entity_type entity_name_or_id ?search_type?
- For components only, returns the geometry visual style.
- 1 - Wireframe geometry
- 2 - Shaded geometry and surface edges
- 3 - Shaded geometry
- 4 - Wireframe geometry and surface lines
- graphictranslation entity_type entity_name_or_id ?search_type?
- For components only, returns the graphic translation x, y and z values.
- id entity_type entity_name_or_id ?search_type?
- Returns the ID of the entity. If search_type is not specified, the search is performed by name only.
- inode entity_type entity_id
- For rbe3 elements and equations only, returns the independent nodes.
- maxid entity_type
- Returns the maximum ID used by entity_type in the HM database. This does not necessarily correspond to the last created entity.
- name entity_type entity_name_or_id ?search_type?
- Returns the name of the entity. If search_type is not specified, the search is performed by ID only.
- named entity_type
- Returns 1 if the entity_type is a named entity, 0 otherwise.
- style entity_type entity_name_or_id ?search_type?
- For components and multibodies only, returns the visual style used.
- 0 - Wireframe elements (see also hm_info elementinternaledgesmode option)
- 1 - Shaded elements
- 2 - Shaded elements and mesh lines
- 3 - Shaded elements and feature lines
- 4 - Transparent elements
- type points entity_id
- Returns vertex, weld, or free.
- visible entity_type entity_name_or_id ?search_type?
- Returns 1 if the entity is visible, 0 otherwise. For entities that have both geometry and element display states, the visibility state of elements is returned. For all other entities, the general visibility state is returned.
- weight entity_type entity_id
- For rbe3 elements and equations only, returns the coefficients for the independent nodes.
- all entity_type entity_name_or_id ?search_type?
- everything entity_type entity_name_or_id ?search_type?
- A list of commonly used values returned in the following order:
- assemblies - name id elementsvisible geometryvisible color
- components - name id elementsvisible geometryvisible color style colortype
- multibodies - name id visibility style
- materials - name id
- properties - name id
- entity_type
- The type of entity to query.
- entity_name_or_id
- The name or ID of the entity.
- search_type
- By default, HyperMesh searches for entities by name, and if the name is not found, it then searches by ID. This option allows you to specify how the search for an entity should be conducted. Valid values are:
Example
To display information on a selected component:
*createmarkpanel components 1 "Select components"
set compList [ hm_getmark components 1 ]
if { ! [ Null compList ] } {
set compId [ lindex $compList 0 ]
set name [ hm_entityinfo name components $compId ]
set color [ hm_entityinfo color components $compId ]
set visible [ hm_entityinfo visible components $compId ]
set style [ hm_entityinfo style components $compId ]
set graphics [ hm_info graphicsmode ]
set colormap [ hm_winfo entitycolors ]
set msgBuff "component:\t$name\n"
append msgBuff "color:\t\t$color\n"
append msgbuff "visible:\t\t$visible\n"
append msgBuff "id:\t\t$compId\n"
append msgBuff "style:\t\t$style\n\n"
append msgBuff "graphics:\t\t$graphics\n\n"
append msgBuff "colormap:"
regsub -all "{" $colormap "" colormap
set cm [ split $colormap "}" ]
for { set i 0; set j 1 } { $i < 16 } { incr i; incr j } {
append msgBuff "\t\t$j = [ lindex $cm $i ]\n"
}
tk_messageBox -message $msgBuff
}
Errors
Incorrect usage results in a Tcl error. To
detect errors, you can use the catch
command:
if { [ catch {command_name...} ] } {
# Handle error
}