Jump to content

npoints function not working


logix1390

Recommended Posts

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

Link to comment
Share on other sites

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 by Noobini
  • Like 1
Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...