Jump to content

addpoint, add attributes


Recommended Posts


So I have some code in a wrangle, that ends with addpoint(). Everything is nice and dandy. But now I think I want some attributes to copy onto new points. There is addattrib() function but im not sure how to make 

i@branch = @ptnum;
if (addpoint(geoself(),pos)) {
    addattrib(geoself(), "point", "branch", 999


So this ofcourse does not do what I want. It just overwrites @branch to 999 for every each point that I managed to addpoit().

And what I want is: for every new addpoint() do addattrib().








Edited by JJ FX
Link to comment
Share on other sites

Can you tell if your Wrangle is set on « points » or « details » ?

When set to run on points, it apply whathever you have coded to each point, while in details mode, it runs once for the geometry. I don’t know what you want to do exactly, but it seems to me you should run it on « details » mode, and write your algorithm to iterate over all points through a loop, check if it’s a new point and set attribute only on those new points (using setpointattrib() maybe ?).

Hope this helps you

Link to comment
Share on other sites

14 hours ago, fencer said:

int np = addpoint(0, @P);
setpointattrib(0, "id", np, 123, "set");


Also if you use:

int np = addpoint(0, @ptnum);

the new point will inherit all attributes (including position) and groups from the source point.

Edit: also note that fencer's code will only work in Houdini 15 (or maybe 16) or later

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

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