How to iterate over groups in H16.5?

   1149   3   0
User Avatar
2 posts
Joined: Jan. 2016
Hello dear Community,

in earlier versions I could iterate over groups with the old for-each networks. How would I do that in the current version? I grouped Prims in several groups and now I want to perform a set of actions on each group. I don't see any option for that in the new nodes. Can someone help me out here?

Best regards,
User Avatar
1732 posts
Joined: June 2008
There is a special syntax where you use the ‘group’ prefix to access groups inside of a wrangle. So it is easy to examine the contents of a group with an IF statement.

if (@group_grp_RED) {
    v@Cd = set (1,0,0);
if (@group_grp_GREEN) {
    v@Cd = set (0,1,0);
if (@group_grp_BLUE) {
    v@Cd = set (0,0,1);
So the actual group name is ‘grp_RED’ not ‘group_grp_RED’.

ap_color_by_group_in_loop.hiplc (76.0 KB)
Untitled-1.jpg (229.8 KB)

Using Houdini Indie

Windows 7 32GB AMD FX8370 @ 4.0Ghz
nVidia 1070GTX 8BG RAM. Driver: 358.87
User Avatar
372 posts
Joined: Oct. 2011
Use a Name node to turn your groups into a ‘name’ attribute before piping into the new for each nodes:
Edited by bonsak - Dec. 5, 2017 09:06:27

foreach-over-groups.hip (75.7 KB)
houdinifx_2017-12-05_15-05-25.png (14.3 KB) []
  • Quick Links