Jump to content

Number of Prims in a group?


monomind

Recommended Posts

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

Link to comment
Share on other sites

// 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;

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...