logix1390 Posted June 7, 2018 Share Posted June 7, 2018 hello, I am just trying to understand how this npoints function works. I want to store the maximum amount of points of another object in a variable called myID so i say: i@myId= 1; @myId = npoints("../PTS"); it should return 1000 points but it returns 0. The help file say this npoints: Returns the number of points in a geometry npoints(surface_node) What am I doing wrong here? I will attach my scene file for anyone who wants to take a look. Thank you npoints_question.hip Quote Link to comment Share on other sites More sharing options...
Noobini Posted June 7, 2018 Share Posted June 7, 2018 you could just wire the PTS into the 2nd input of the wrangle and use npoints(1) i guess... Quote Link to comment Share on other sites More sharing options...
Noobini Posted June 7, 2018 Share Posted June 7, 2018 (edited) or as orig setup use: i@myId = npoints("op:../PTS"); Also, be very careful when you use the help...there's VEX function and then there's expression function They have slightly different syntax, when I first started I lost a bit of hair over this. Since you are in a wrangle...you should look up VEX function and not expression function (usually quickie one-liners) So the help you posted....that's for an expression function (tho in this case the syntax is the same...but note it says surface node and that's it). If you use the help for VEX function...read further, it says: <geometry> When running in the context of a node (such as a wrangle SOP), this argument can be an integer representing the input number (starting at 0) to read the geometry from. Alternatively, the argument can be a string specifying a geometry file (for example, a .bgeo) to read from. When running inside Houdini, this can be an op:/path/to/sop reference. and hence, that's where I got the op: from... Edited June 7, 2018 by Noobini 1 Quote Link to comment Share on other sites More sharing options...
logix1390 Posted June 7, 2018 Author Share Posted June 7, 2018 Thanks noobini. Both methods work perfect ! But i'm a little confused on why my method doesn't work ? Quote Link to comment Share on other sites More sharing options...
toadstorm Posted June 7, 2018 Share Posted June 7, 2018 In VEX specifically, anytime you're trying to load data from something (SOP geometry, COP pixel data, etc) instead of just grabbing a node name or channels from that node, you need to preface the path with op: in order to tell Houdini that you actually intend to cook that operator and retrieve the data. Quote Link to comment Share on other sites More sharing options...
logix1390 Posted June 7, 2018 Author Share Posted June 7, 2018 I see, thanks guys! 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.