6.7. RepeatAction (structured action)

<repeatAction> ‐ A controlled loop of a sequence of structured actions

6.7.1. Attributes

NameTypeDefaults
idSTRINGNone (required)
beginINTEGERNone (required)
endINTEGERNone (required)
stepINTEGERNone (required)

6.7.2. Description

The repeatAction element is used to control the execution of a sequence of structured actions.

The string value of the id attribute defines the name of the control variable that must be carried by the node to which the script with the repeatAction is attached. The control variable must be a integer or float scalar. The integer values b, e, s of the begin, end, and step attributes define the values used to control the execution of the loop. Before the execution, the control variable is initialized with the value b. Before each loop the value of the control variable is compared with e, and execution of the loop is continued as long as the control variable is less or equal to e. After each execution of the internal actions, the control variable is incremented by a value of s.

6.7.3. Expected children

A sequence of structured actions: action, repeatAction, whileAction, or ifAction elements.

6.7.4. Example

The following examples is a repeatAction executed {#nbClas.1} times for values of the scalar variable n between 1 and {#nbClas.1}:


<repeatAction begin="1" end="{#nbClas.1}" step="1" id="n">
  <action>
    <set_node_attribute_value operator="=">
      <transformation x="({$class.1:class.1.X[({$class.1:n})]})" 
                      y="({$class.1:class.1.Y[({$class.1:n})]})"
                      z="({$class.1:class.1.Z[({$class.1:n})]})" />
    </set_node_attribute_value>
    <target type="single_node" value="#class.1.({$class.1:n})_position" />
  </action>
  <action>
    <send_message value="initialization" />
    <target type="single_node" value="#class.1.({$class.1:n})" />
  </action>
</repeatAction>