arjanM Posted November 8, 2016 Share Posted November 8, 2016 Hi, is it possible to access the points I create in a wrangle with the addpoint function in the same wrangle? I have an attribute wrangle that only runs once. Within that wrangle I made a for loop where I create points. Then I want search for neigbouring points within the points I created so far in the same loop. I could store the positions in array and loop through the array of the positions I stored so far within the loop, but that can get pretty slow. I hope I explained this well anough. I there any way to do this or should I have another approach for this? Quote Link to comment Share on other sites More sharing options...
Atom Posted November 9, 2016 Share Posted November 9, 2016 (edited) In these situations, it might be better to just drop down another wrangle after the first one. Then run the loop again, essentially in a new context. You don't need to store the points again in an array because you just created them and now they exist down stream. The second wrangle can pick up on that. Remember, when you run code in Detail mode (only once) you lose the multi-processing benefit of VEX, so you could just as effectively construct a python solution instead if you are more comfortable in that programming language. Edited November 9, 2016 by Atom 1 Quote Link to comment Share on other sites More sharing options...
f1480187 Posted November 9, 2016 Share Posted November 9, 2016 Not possible in your concrete case, but possible in limited other situations, where you can use the new point number to set it's attribute or create vertices and primitives with it. All geometry created inside loop added at the end of the cook. When you access something like nearpoints you use input number, which is not the geometry being processed, but the upstream geometry: int pt = addpoint(0, {1,0,0}); // An exact pt value will be lastpointnum+1. @Cd = point(0, "P", pt); // Cd will be zero, not red, since there is no such point number on input. Technically, there is geoself() function, but it always outputs 0, I'll guess it's either not implemented in Houdini 15.5 or it was always meant to be the first input. int pt = addpoint(geoself(), {1,0,0}); @Cd = point(geoself(), "P", pt); // Cd still will be zero, not red. Quote Link to comment Share on other sites More sharing options...
arjanM Posted November 9, 2016 Author Share Posted November 9, 2016 Thanks for the quick answers. That is too bad something like this isn't supported. I am trying to make something like a curve that grows on a surface, so the position of the new point is depended of the last point. I want to use the neighbors function to check if there are points nearby so the new point will move away from the other points. Would it be possible to write the newly created point to a geometry file in the wrangle and then use that geometry file with the neighbors function? I also could just add 1 new point in the wrangle and put that between for loop network nodes, but that isn't as easy as putting everything in one wrangle. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.