Jump to content

inpointgroup and npointsgroup not working

Recommended Posts

inpointgroup and npointsgroup aren't working for me (Indie 18.0.416).

I have a grid with an attribute from map image.  I manually select different areas of the grid and add those selections to various named groups.  I then add a scatter node to generate scatter points over the grid. 

The scatter points appear to inherit the group memberships from the underlying areas of the grid - prior to the scatter node, the info popup shows the various group names as prim groups and in/after the scatter node the group names appear as point groups.

I then run some code in a detail attribute wrangle to loop through a particular group's scatter points (those of a cypress tree in the image, group 'Cypress') to identify points lying along the boundary of that group (ie. the boundary of the cypress tree).  I then add those boundary points to a group named 'Cypress_edge', using

setpointgroup(0, 'Cypress_edge', pointNum, 1, 'set');

I can see in the geometry spreadsheet that this has worked - there are now points having membership in both the original group 'Cypress' (88,850 points) and the 'Cypress_edge' group (8,120 points).

However, when I then check-test the boundary points for membership of the 'Cypress_edge' group using

inpointgroup(0, edgegroupname, pointNum)

they don't show membership (inpointgroup returns zero for every point).

Also, if I ask how many points are in the 'Cypress_edge' group, using

npointsgroup(0, edgegroupname)

the answer is zero, even though there are 8,120 points in the geometry spreadsheet's 'Cypress_edge' column that have a value of 1.

inpointgroup and npointsgroup work for the point groups that existed prior to the VEX wrangle but not for the 'Cypress_edge' group that was created inside the wrangle.

I'd appreciate any advice about what I might be doing wrong!


I've finally realized that inpointgroup and npointsgroup are looking backwards at the preceding node (ie. through input 0), and there are no edge points yet in that previous node.

So, while

setpointgroup(0, 'Cypress_edge', pointNum, 1, 'set');

creates the group 'Cypress_edge' (on its first call) and sets its member points' include values to 1, I also need to set

@group_Cypress_edge = true;

to tell the local wrangle that the point is a member, and I also need to use


to test for membership locally.

I'm not sure how to get the number of points in Cypress_edge using this method though, other than looping through all the points and doing a count.  I also have some further questions about this method but I'll leave those for a separate post.

Edited by ianwww
Found a solution

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now