VEX - testing attributes within a group of attributes

   387   3   2
User Avatar
Member
3 posts
Joined: Dec. 2017
Offline
Hi,

I have some primitives that have an attribute "class" and I would like to assign an attribute "@unique=1" to each primitives that only have the same value for "class2" for the same value of "class".

--> if there's only the same value for "class2" for all the primitives with the same "class" value then assign to all of this primitives the attribute "unique" with a value of 1 and if there's more than one unique value, give them a value of 0

I tried to promote the "class" attibute to groups but I didn't manage to run the test for each group
Any help/guidance would be super welcome, thank you!

Attachments:
houdini_01.jpg (188.5 KB)

User Avatar
Member
393 posts
Joined: Nov. 2016
Offline
You could do a "for each named primitive" loop using class, and assign @unique=1 when the length of uniquevals(0, 'prim', 'class2') is 1.
User Avatar
Member
8555 posts
Joined: July 2007
Online
you can also use 2 attrib promotes to get min and max of "class2" from prim to prim using "class" as piece attrib

then do prim Wrangle:
i@unique = i@min == i@max;
Edited by tamte - Feb. 20, 2024 16:47:09
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
3 posts
Joined: Dec. 2017
Offline
Thank you very much, it worked perfectly!
  • Quick Links