JH12 Posted July 14, 2022 Share Posted July 14, 2022 (edited) Wondering why this behavior exists: I create a bunch of points in a Detail wrangle using this code. After the loop, when trying to print the value of any point attribute, it always returns {0,0,0}. If I wire in a second wrangle and try to print the value using the same last two lines of code, the P vector prints correctly. What is the logic behind this? int i; for (i=0; i<100; i++){ float x = rand(i); float y = rand(i*2); float z = rand(i*3); vector v = set(x,y,z); addpoint(geoself(), v); } vector val = point(geoself(), "P", 5); printf("%g", val); Edited July 14, 2022 by JH12 Quote Link to comment Share on other sites More sharing options...
animatrix Posted July 14, 2022 Share Posted July 14, 2022 Hi, You can't access attributes of a point you just created inside the same wrangle node. 2 Quote Link to comment Share on other sites More sharing options...
JH12 Posted July 14, 2022 Author Share Posted July 14, 2022 Thanks, and why is this? Quote Link to comment Share on other sites More sharing options...
animatrix Posted July 15, 2022 Share Posted July 15, 2022 Because the geometry creation happens after the entire VEX code is executed and the result is finalized as the output of that particular wrangle. So you don't have those geometry actually created while you are still in the same VEX kernel, but after. That's why you can't use them in the same code that used to create them. Quote Link to comment Share on other sites More sharing options...
JH12 Posted July 15, 2022 Author Share Posted July 15, 2022 Thanks for the explanation Quote Link to comment Share on other sites More sharing options...
carthick Posted July 16, 2022 Share Posted July 16, 2022 On 7/14/2022 at 3:49 PM, JH12 said: Thanks, and why is this? i was stumped for while when i first ran into this.. think of it like this.. your wrangle works on input 0. and input 0 doesn't have the points... you are querying . as simple as that . 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.