Jump to content

inpointgroup and npointsgroup not working


ianwww

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!

[SOLVED]

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

if(@group_Cypress_edge)

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