*setvalue

Updates an existing entity/entities with new/modified data.

Syntax

*setvalue entity_type <select_type>=<selection> <name1>=<value1> ?<name2>=<value2>? ... ?<nameN>=<valueN>? ?row=<row_index>? ?column=<column_index>? ?STATUS=<status>? ?locationunit={<entity_id>, <face_index>}? ?modelname=<name_of_model>?

Type

HyperMesh Tcl Modify Command

Description

Updates an existing entity/entities with new/modified data. Data names, attributes, and metadata are allowed to be modified, assuming the proper card image is also assigned. If the specified data name is “name” and the entity type is enabled for the name pool, the provided name is used to update the solver name.

Inputs

entity_type
The type of entity to modify.
<select_type>=<selection>
The entity or entities that are to be modified. There are several ways to provide the entities to be modified. Only one option can be used at a time:
id=<id>
The ID of the single entity to modify.
name=<name>
The name of the single entity to modify.
mark=<mark_id>
The ID of the mark containing the entities to modify.
list=<list_id>
The ID of the list containing the entities to modify.
user_ids={<id1> <id2> ... <idN>}
The IDs of one or more entities to modify.
user_names={<name1> <name2> ... <nameN>}
The names of one or more entities to modify.
<name>=<value>
The name=value data name, attribute, and/or metadata pairs that define the relevant data for the entity. This is also used to parameterize/unparameterize the attributes and data names, and is used to create metadata if not there with the specified name. For attributes, this can be either the attribute name or ID.
For entity attributes, both the entity type and the entity IDs must be provided. For example:
*setvalue elements id=7 3222={elems 3}
Metadata update is of the form metadata={<name> <value>}. Both the name and value must be provided. For example to update my_metadata_int to 15 on component 1:
*setvalue comps id=1 metadata={my_metadata_int 15}
For assigning a parameter, both the entity type and the entity name must be provided. For example:
*setvalue mats id=1 Rho={parameter parameter_name}
When unassigning a parameter from an attribute/data name, the entity type needs to be followed by empty quotes. The attribute/data name is automatically assigned the value of the parameter at the time of unassigning. For example:
*setvalue mats id=1 Rho={parameter "" }
Creating metadata is of the form metadata={<name> <value> <type>}. For example, to create metadata of type integer with name my_metadata_int to 15 on component 1:
*setvalue comps id=1 metadata={my_metadata_int 15 integer}
column=<column_index> (optional)
Column index for a 2D array. Used together with row_index, it sets the value at the specified row_index and column_index.
locationunit={<entity_id>, <face_index>}
Valid only for engineering loads. This is required if a non-uniform load is being updated. If the load is applied on a regular set, only <entity_id> is needed. If the load is applied on solid element faces, then <face_index> is also required.
entity_id
The ID of the entity to update.
face_index
The index of the solid element face.
modelname=<name_of_model>
This is the optional model name to update when there are multiple models in the database. If not specified, the current model is used.
row=<row_index> (optional)
Thel row index for a 1D or 2D array. For 1D array, it sets the single value at the specified index. For a 2D array, it must be used together with column_index. This is mandatory for string arrays. For example, to update a string array of size 2:
STATUS=<status>
This sets an attribute status value. Valid values are 0 (attribute is off), 1 (attribute is on) or 2 (attribute is always on). Notice that STATUS must be capitalized.

Examples

Update the node IDs in a set named node_set:

*setvalue sets name=node_set ids={nodes 1 2 3 4 5 6 7 8}

Update the name of entity set with ID 1:

*setvalue sets id=1 name=new_setnodes

Update the attribute Rho of material ID 1 along with Status to value 1:

*setvalue mats id=1 Rho=1.1 STATUS=1

or

*setvalue mats id=1 183=1.1 STATUS=1

Update materialid to 2 for components on mark 1:

*setvalue comps mark=1 materialid=2

Update node1 to 2 for elements 1 and 2 on list 1:

*setvalue elems list=1 node1=2

Update materialid to 2 for components with IDs 1 and 2:

*setvalue comps user_ids={1 2} materialid=2

Update materialid to 2 for components with names "mid" and "center":

*setvalue comps user_names={mid center} materialid=2
Update the entire magnitude for non-uniform distributed load 5:
*setvalue loads id=5 magnitude={5 4 10 15 20}
Update the magnitude for non-uniform distributed load 5 for solid element 1654 face 3:
*setvalue loads id=5 magnitude=15 locationunit={1654,3}
Update the metadata value of type integer with name mymeta_int to value 15 for a component:
*setvalue comps id=1 metadata={mymeta_int 15}
Update the metadata value of type entity with name mymeta_entity to material 3 for a component:
*setvalue comps id=1 metadata= {mymeta_entity {mats 3}}
Update the metadata value of type entity_array with name mymeta_entityarray to material 1, 3 for a component:
*setvalue comps id=1 metadata= {mymeta_entityarray {mats 1 3}}

Errors

Incorrect usage results in a Tcl error. To detect errors, you can use the catch command:
if { [ catch {command_name...} ] } {
   # Handle error
}

Version History

13.0

2020 - Added new option locationunit.

2020.1 - Added new option modelname. Added support for <name>=<value> for metadata.

2021.2 - Added support for creating metadata and assigning and unassigning parameters.