Jump to content

How to get the group name from points?


teddy28

Recommended Posts

Hi everyone,

 

I would like to get the group name from attribute "flag" > 0. Then set some attribute to the whole group's points.

 

I set the point number 276's flag attribute to 1. And it should belongs to 3 groups(inactive,group_276,and pieceXX).

 

I had searched for solution and some said it can be done by using pointgrouplist. But I have no idea how to use it for checking.

 

 

Anyone can help? Many thanks!

pointgroup_question.hip

Link to comment
Share on other sites

What about something like this in a Point Wrangle placed at the end of your network chain?

 

The flag will be set to 1.0 if it is in the active group.

int result = inpointgroup(0,"active",@ptnum);
if (result) {
    setpointattrib(0,"flag",@ptnum,1.0,"set");
}

There are other point based attribute functions you can leverage as well.

https://www.sidefx.com/docs/houdini14.0/vex/functions/

Edited by Atom
  • Like 1
Link to comment
Share on other sites

What about something like this in a Point Wrangle placed at the end of your network chain?

 

The flag will be set to 1.0 if it is in the active group.

int result = inpointgroup(0,"active",@ptnum);
if (result) {
    setpointattrib(0,"flag",@ptnum,1.0,"set");
}

There are other point based attribute functions you can leverage as well.

https://www.sidefx.com/docs/houdini14.0/vex/functions/

Thanks for reply.

 

But what I want to do is if the points' attribute "flag" > 1 then set another attribute to 1 for the group "pieceXX" that the points belongs to.

So I want to get what group that the point belongs to.

Edited by teddy28
Link to comment
Share on other sites

...

So I want to get what group that the point belongs to.

this will give you list of all point groups each point belongs to as string array attrib called ptingrps

string ptgrps[] = detailintrinsic(0, "pointgroups");
s[]@ptingrps = {};
foreach(string grp;ptgrps)
{
    if (inpointgroup(0, grp, @ptnum)) append(s[]@ptingrps, grp);
}
  • Like 7
  • Thanks 1
Link to comment
Share on other sites

 

this will give you list of all point groups each point belongs to as string array attrib called ptingrps

string ptgrps[] = detailintrinsic(0, "pointgroups");
s[]@ptingrps = {};
foreach(string grp;ptgrps)
{
    if (inpointgroup(0, grp, @ptnum)) append(s[]@ptingrps, grp);
}

 

Thanks! It works perfectly :D

Edited by teddy28
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...