ForEach surface node

Repeatedly applies a set of SOPs to the input geometry.

All Parameters Inputs Example files

See also: Each

This operator has two main functions:

These effects are achieved with the help of the Each SOP which will handle the culling of the geometry or the acquiring of the feedback geometry. Add new SOPs after the Each SOP inside the subnet.

Note

It is possible to use multiple Each SOPs, or even avoid the Each SOP entirely and use the stamp expression, to achieve more complicated effects.

The ForEach SOP in all cases works with Primitive Groups or Primitive Attributes. Other groups or attributes should first be promoted to Primitive before they can be used. Alternatively, the For Each Number may be used manually performing the For Each Group or For Each Attribute behavior.

Parameters

For

Each Group

Determines all primitive groups that match the group mask found in the input geometry. Runs the contained SOPs once for each group with the stamp set to the name of the group.

Each Attribute Value

For the given primitive attribute, determines how many unique values it has in the input geometry. Runs the contained SOPs for each unique attribute value with the stamp set to the value of the attribute. The Tolerance is used to determine what is considered unique.

Each Number

Runs the contained SOPs once for each number in the given number range. If the number range is invalid, runs a zero number of times.

Stamp Name

In each iteration of the For Each SOP, the current value of the iteration will be stamped to this variable. If it is an attribute with vector value, stampnames suffixed with 1, 2, and 3 will be created for the components of the vector. (With default values, this corresponds to FORVALUE1, FORVALUE2, and FORVALUE3) You can use the stamp() expression to get at the value inside the ForEach sop. If it has string value, such as a group value or string attribute value, you can use stamps() to get the value.

Group Mask

Any groups that match this pattern in the input geometry will be iterated over in the For Each Group mode. The use of wildcards like “*“ and ”?“ is allowed.

Attribute

The name of the primitive attribute to examine for unique values when using For Each Attribute Value.

Tolerance

The amount the attribute is allowed to differ but still be considered identical for the purpose of finding unique attributes. This allows small errors in an attribute value from triggering unique passes.

Number Range

Specifies the start, end, and increment for processing by each number. The processing is done from the start value up to and including the end value. Each iteration the value increases by the increment. Negative increments are allowed, but in this case the end value has to be below the start value.

Max Iterations

Prevents the For Each sop from executing more than the proscribed number of iterations. This is useful as a sanity test for dealing with problematic geometry and as a method of debugging to find out which iteration started to fail.

Merge Results

Determines if the output of each round of iteration should be merged together. If not set, only the final round of iteration is used. When doing a For Each Group one will often want to use the Merge Results to collate the separate iterations together. However, if doing a feedback based system, this should be turned off as only the final result is desired.

Inputs

Input to Detect Groups/Attributes From

When in For Each Group or For Each Attribute mode, the first input is cooked to determine the matching groups or possible attribute values.

Auxiliary Input

Auxiliary inputs are available to bring additional geometry inside the scope of the For Each SOP.

Example files

cheese

$HFS/houdini/help/examples/nodes/sop/foreach/cheese.otl

Load | Launch

This example shows how to use the For Each SOP to individually boolean a bunch of self intersecting spheres with a cheese wedge.

cutup

$HFS/houdini/help/examples/nodes/sop/foreach/cutup.otl

Load | Launch

This example shows how to use the foreach sop to intersect one object with each part of another object and merge the results together.

Usages in other examples

Example name Example for

Dop Import surface node

Load | Launch