For-EachLoop over groups.

   5468   2   3
User Avatar
Member
17 posts
Joined: May 2016
Offline
Hello guys,

Is there any trick to make the ‘new’ ‘for-each loop’ to work like the ‘old’ ‘for-each subnetwork’ ?

By default the ‘for-each subnetwork’ loop over every groups. In the other hand ‘for-each loop’ loops over every
pieces that get the same name attribute. (at least that's how I understand it).

So far I was using the assemble operator before the ‘for-each loop’, as looping over connected geometry was all I neededed.

But I can't figure out how prepare my geo (I mean creating the right attributes) so the ‘for-each loop’ can loop over the different groups from my asset.

Hope the question makes sense
And thanks for any guidance !
Edited by PascalBkm - March 23, 2017 14:00:06
User Avatar
Staff
6219 posts
Joined: July 2005
Offline
Do the groups overlap? Usually they do not. In which case it is very inefficient to work over groups. Instead you can turn the groups into a name attribute.

The Name SOP has Name From Group option that will take a group pattern and set the name of each primitive to be the group it is contained in. Then you can run the foreach over the Name attribute.
User Avatar
Member
17 posts
Joined: May 2016
Offline
Hi jlait,

No, the groups do not overlap. (it's an asset coming from 3dsmax).

I'm discovering the name operator right now, so thanks for the help.
I was able to assign manually a name to a selected group, but I still don't get how to assign names automatically for all the groups at once.

'Name from group' doesn't seems to change anything in the spreadsheet, not sure what to put in the group mask (I use a ‘*’ for the moment).

I'm pretty sure the solution is close, so I will continue to investigate.

Edit/

Ok got it, you have to remove the empty group/name houdini creates by default in the name operator.

Thanks a lot sir !
Edited by PascalBkm - March 24, 2017 17:22:34
  • Quick Links