7.17. SetGraphValues

set_graph_particle_value ‐ Dynamic modification of graph particles

set_graph_edge_value ‐ Dynamic modification of graph edges

set_graph_joint_value ‐ Dynamic modification of graph joints

set_graph_particle_uniform_value ‐ Dynamic uniform modification of all the particles in a graph

set_graph_edge_uniform_value ‐ Dynamic uniform modification of all the edges in a graph

set_graph_joint_uniform_value ‐ Dynamic uniform modification of all the joints in a graph

7.17.1. Attributes

NameTypeDefaults
indexINTEGERNone (required)
operatorSTRINGNone (required)

7.17.2. Description

These actions are used to modify the values associated with some of the geometrical components of a graph element. If the attribute values contain parenthesized expressions, they are dynamically evaluated as numerical expressions and their values are replaced in the attribute value strings.

The integer value object no of the index attribute defines the rank of the object in the list of objects of its type (particles for set_graph_particle_value, edges for set_graph_edge_value, and joints for set_graph_joint_value). Ranks begin at 1.

In the case of uniform modifications (set_graph_particle_uniform_value, set_graph_edge_uniform_value, and set_graph_joint_uniform_value) the action is applied to all the particles, edges, or joints in the graph.

The string value of the operator attribute is an operator string. The values of the operator must be "=", "=", "+=", "-=", "*=", or "/=". The child node is a particle, an edge, or a joint element that contains at least one attribute and its associated value.

The attributes of the child node are called source attributes. If the target node contains at least object no particles, edges, or joints depending on the selected action, the values of the source attributes are used to modify the values of the corresponding attributes in the object number object no of the target graph node.

For instance if the action is set_graph_particle_value and if the child node is a particle that contains the attribute m, and if the operator is "=", the source attribute value is used to instantiate the mass of the target particle (the particle number object no). The other operators respectively correspond to addition, substraction, multiplication, and division of the target values by the source values. The attributes of the target object that are not instantiated in the source object (the child node) are not modified by this action.

7.17.3. Expected children

The following element must occur in set_graph_particle_value, set_graph_edge_value, or set_graph_joint_value: one particle, one edge, or one joint element.

7.17.4. Expected target

The target node must contain a graph element.

7.17.5. Example

The example below defines an action that decreases the initial length of the first edge by 0.1.

<set_graph_edge_value index="1" operator="-=">
  <edge lIni="0.1"/>
</set_graph_edge_value>

The example below defines an action that decreases the mass of all the particles in a graph by 0.01.

<set_graph_particle_uniform_value operator="-=">
  <particle m="0.01"/>
</set_graph_particle_uniform_value>