monomind 2 Posted Sunday at 11:42 PM Is there any way to get the number of primitives in a group? I've been trying to figure out. Share this post Link to post Share on other sites
anim 1,192 Posted Monday at 12:31 AM In VEX: nprimitivesgroup() In Hscript: nprimsgroup() Share this post Link to post Share on other sites
monomind 2 Posted Monday at 12:55 AM oh my bad! Trying to get number of pieces in a group - where each piece is multiple primitives. (voronoi pieces) Share this post Link to post Share on other sites
anim 1,192 Posted Monday at 01:07 AM there is no guarantee that the group contains all the primitives of the piece, but to check how many unique different piece attribute values are there in the geo you can use nuniqueval() so delete all geo except for your group and call this function on resulting geo If however you are certain that all the prims of each piece are either in or not in the group you can use Pack SOP to pack pieces based on your piece attribute and transfer the group, then just count prims within that group as per first post Share this post Link to post Share on other sites
ftaswin 17 Posted Monday at 03:20 AM // in detail wrangle : int prims[] = expandprimgroup(0,"primgroupname"); string pieces[] = {}; foreach(int p;prims) { string nm = prim(0,"name",p); if(find(pieces, nm) < 0) { append(pieces, nm); } } s[]@nm = pieces; Share this post Link to post Share on other sites