Jump to content

Point groups


Macha

Recommended Posts

Hey Macha,

 

Can't provide the hip atm but try this:

 

1- pipe your points into a VOPSOP, 

2- create a for/while loop inside the vopsop that iterates as many times as the number of point groups  (using the pointgrouplist() ).
2- Inside the while or for loop you can use an ingroup-VOP and check if the point belongs to the specified group being iterated.

 

You can then apply those to an array and convert to a list of strings or whatever you want :)

I will take a look at this solution. But it should work

 

Cheers,

Huds

Link to comment
Share on other sites

Hey, thanks but I wanted to do this with the HDK.

 

So far, this is my attempt, but I think it just gives me all the groups, and how many are in each group but now what?

    const GA_ElementGroupTable & grpTable = gdp->getElementGroupTable(GA_ATTRIB_POINT);

    for (GA_GroupTable::iterator<GA_ElementGroup> it=grpTable.beginTraverse(); !it.atEnd(); ++it)
    {
        GA_PointGroup *group = static_cast<GA_PointGroup*>( it.group() );
        cout << "groups?" << group->entries() << endl;
    }
Edited by Macha
Link to comment
Share on other sites

Oh you want to do it in HDK. Then I can't help you sir. Still noobing around with vex, hehe.

 

But if it helps, the vex code to check if the point belongs to a group is: ingroup( "group" , ptnum );

 

If you find out how to write that vex-function in HDK then you are settlet I think. If the case is that your loop goes through all point groups.

 

Man I feel ashamed I haven't written anything in HDK  :unsure:.

 

Anyhow I hope someone else will show you the missing piece.

 

GL Macha!

Link to comment
Share on other sites

There isn't a direct mapping between a point and it's group since the points can definitely be in 0 or more groups.  You'd probably just want to iterate over every point and for each point iterate over all the point groups and see which, if any, the point belongs too.

Link to comment
Share on other sites

Would this be OK? It seems to work.

void inGroup(const GU_Detail *gdp)
{
    using namespace std;

    GA_PointGroup*  grp;

    GA_FOR_ALL_POINTGROUPS(gdp, grp){
        
        GA_Offset  ptOff;
        GA_FOR_ALL_PTOFF(gdp, ptOff){

            if (grp->containsOffset(ptOff)){
                cout << "Point[" <<ptOff<<"] in group: " << grp->getName() << endl;
            }
          
        }
      
    }

}

Link to comment
Share on other sites

I've actually got a really annoying problem with inlinecpp. 

 

Very often I get a compile error:

GeometryPermissionError: Geometry is read-only.
You cannot pass a read-only hou.Geometry object to a function expecting a non-const GU_Detail *

But the code all looks fine. I then have to exit Houdini, close the shell, reopen, restart and the whole thing works again.

 

Has anybody experienced this?

Link to comment
Share on other sites

Don't think I've seen that one before.  Assuming the function is the same as the previous post (with a const GU_Detail  *) I don't see why Houdini would ever complain about with that error.  Are you on Windows by chance?  I seem to recall inlinecpp being more difficult there.

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...