Wrangle ingroup

   12449   4   1
User Avatar
Member
190 posts
Joined: April 2009
Offline
I would like to get a bit more familiar with the wrangle nodes and thought up a little example for myself but i'm stuck.
What i would like to do is set an attribute (Cd for example) depending on what group the point belongs to. The ingroup vex function errors out though.
I tried creating a vopsop, building the functionality and copy the vex-code but that didn't work.
Could anybody point me in the right direction? How to check for group membership in a wrangle node?

Cheers,

Rudi
User Avatar
Member
8581 posts
Joined: July 2007
Offline
ingroup() works only in Point Wrangle

for CVEX based wrangle nodes (Attrib, Geometry, POP Wrangle …) use inpointgroup() or inprimgroup()

http://www.sidefx.com/docs/houdini13.0/vex/functions/inpointgroup [sidefx.com]
http://www.sidefx.com/docs/houdini13.0/vex/functions/inprimgroup [sidefx.com]

something like

@Cd = inpointgroup(@OpInput1, “group1”, @ptnum);
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
2624 posts
Joined: Aug. 2006
Offline
Thats a nice tip Tomas !

Rob
Gone fishing
User Avatar
Member
190 posts
Joined: April 2009
Offline
Thanks Tomas for the reply.
I found that:
if (@group_plate_1x1_302423_darblu_sld_02 == 1)
@Cd = set (1,0,0);

works as well.
I would like however to have the option to use wildcards in the groupname. Using * here errors the VEXpression again.
In inpointgroup the groupname doesn't accept wildcards neither like this:
@Cd = inpointgroup(@OpInput1, “*_darblu_*”, @ptnum);

Obviously i still have a lot to learn.
Rudi
User Avatar
Staff
6219 posts
Joined: July 2005
Offline
There isn't a pointgroupmask() function in VEX yet.

The work around is to make a string parameter on your wrangle and invoke the pointgroupmask() expression there. You can chs() it into VEX, and then run inpointgroup on each such group:

int result = 0;
string chosengroups = split(chs(“maskparm”));
foreach (string group; chosengroups)
{
result |= inpointgroup(0, group, @ptnum);
}

Note if there are no groups on your input, * will then result in no points being selected, which might not be what you expect…
  • Quick Links