Hello all,
I have been having an issue with an Attribute Wrangle node that I am using to output the different lengths between each set of two points along a custom shape that I have made. I want to be able to use this shape to output a number of walls for a building of 1 unit in length to match proportionately with the distance between each of the points. I have included the project file as an attachment below including two screenshots of the code and the data. The wrangle node prints out the correct values and places them into an array. While I do have the right values, I am unable to generate all of the values within an attribute. It is only returning the final value and copying it to each of the points. I am still fairly new to Houdini and any help with this would be very much appreciated.
Thank you.
Using VEX to find the lengths between each set of two points
2466 2 2-
- granterdoes
- Member
- 1 posts
- Joined: Jan. 2018
- Offline
-
- Tanto
- Member
- 550 posts
- Joined: Nov. 2016
- Offline
The wrangle node already iterates over each point, so basically, you're running your whole “for” loop once for each point and keeping the last value it calculates (the value for the last point) as its distance attribute.
I guess an easy way to get your value would be to add:
after your for loop.
Or else rewrite your code taking into account that your wrangle node is already basically a “for” loop, with i@ptnum representing the point number currently being iterated on.
I guess an easy way to get your value would be to add:
f@distance = val_array[i@ptnum];
after your for loop.
Or else rewrite your code taking into account that your wrangle node is already basically a “for” loop, with i@ptnum representing the point number currently being iterated on.
Edited by Tanto - June 27, 2019 17:04:07
-
- BabaJ
- Member
- 2177 posts
- Joined: Sept. 2015
- Offline
It's because you are using the same point number reference for each loop for ‘each point run over’.
Look at your two variables pos1 and pos2. They are both using reference to ‘i’, which always starts at zero and is used in the point function.
You might want to do something reference the actual point being run over to start with - @ptnum, and modulus to take care of cycling through the point number range, like:
Look at your two variables pos1 and pos2. They are both using reference to ‘i’, which always starts at zero and is used in the point function.
You might want to do something reference the actual point being run over to start with - @ptnum, and modulus to take care of cycling through the point number range, like:
vector pos1 = point(0,"P", @ptnum );
vector pos2 = point(0,"P", (@ptnum + (i +1)) % npoints(geoself()) );
Edited by BabaJ - June 27, 2019 17:18:18
-
- Quick Links


