Jump to content
Sign in to follow this  
JJ FX

addpoint, add attributes

Recommended Posts

Hi, 

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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Yes yes yes exactly setpointattrib. Figured it out in the morning. But big thanks!

No need for silly attr transfer sop now, so cool :D

Edited by JJ FX

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
Sign in to follow this  

×