Groups#
Houdini supports complex group selection expressions
Common Patterns#
Pattern | Description |
---|---|
* |
In the Group SOP: all points/primitives. In other SOPs: every named group. |
n |
Point/primitive number n. |
n-m |
Points/primitives numbered from n to m (inclusive). |
n-m:step |
Points/primitives numbered from n to m (inclusive) skipping every step. For example, 1-100:2 means every other number from 1 to 100. |
n-m:keep,step |
Points/primitives numbered from n to m (inclusive). Use the first keep numbers and then skip every step after that. |
!pattern |
Every point/primitive except the ones matching the pattern. For example, !1-10 means every point/primitive except the numbers 1 to 10. pattern may be a numeric pattern, attribute pattern, or group name pattern. |
^pattern |
Remove points/primitives matching the pattern from the results of the preceding pattern. For example, 0-100:2 ^10-20 means every other number from 1 to 100 except the numbers 10 to 20. pattern may be a numeric pattern, attribute pattern, or group name pattern. |
@attributeopvalue |
Selects the points/primitives where attribute matches value, based on the op, which can be one of =, == (same as =), !=, >, <, >=, or <=. For example, @v>0 will create a group of all points whose v attribute is greater than 0. You can specify components using [index] after the attribute name, for example @Cd[2] will get the blue channel of the diffuse color (Cd) attribute. As a convenience, you can also use .x, .y, and .z instead of [0], [1], and [2], for example P.x to get the X-axis component of the position (P) attribute. (If you don’t specify a component for a multi-component attribute type, the comparison will use the first component.) For example, @P.y>0 will create a group of all points whose Y component is greater than 0. For string attributes you must put quotation marks around the value if it contains spaces, for example @myattr="foo bar". You can use wildcards (* and ?) in the value when using =, ==, and != on string attributes. You can combine the attribute syntax and the range syntax: @id=5-10 You can also use the attribute syntax with a space separated list of integer values, but you need to enclose the list in quotes: @id="5 8 10 15" |
group_name |
In SOPs other than the Group SOP, you can specify a named group of points/primitives (created with the Group SOP). You can use pattern matching (, ?, and [ ]) in the group name. For example, arm includes all point/primitive groups whose names start with arm. ^ can be used in the pattern by enclosing the pattern in { } . For example, {arm* ^arm3*} includes all groups whose names start with arm, but not arm3. |
Cookbook#
- Every Other Point:
*:2
- All points but the last
C0-`npoints(opinputpath(“.”,0))-2`
- Create a group within sphere radius bounds limited to closest
npoints
Cint maxNumPts = chi("maxNumPts"); vector4 visFilterSphereCenterRadius = chp("visFilterSphereCenterRadius"); int closept[] = nearpoints(0, set(visFilterSphereCenterRadius.x,visFilterSphereCenterRadius.y,visFilterSphereCenterRadius.z), visFilterSphereCenterRadius.w, maxNumPts); foreach(int ptnm; closept) { setpointgroup(0, 'visFilter', ptnm, 1, 'set'); }