Jump to content

int npoints(string filename)


Recommended Posts

I stuck with a simple VEX question.

I have to get the npoins of a geometry use attribute wrangle.

 

int npoints(int input_number)  really do well.

but i was confused with the second expression.

  • int npoints(string filename)

  • Returns the number of points for all primitives in the geometry file. 

 

How to use it.

Thanks.

Link to comment
Share on other sites

i@mypoints = npoints(0);

That creates an attribute with the value of how many points the first input to your wrangle has. To use the second input, npoints(1) and so on.

 

Not sure if it works in a wrangle, but as a normal expression with the one that requires a string, you typically do:

npoints("../sphere1")

Link to comment
Share on other sites

 sorry the file didn't attach .. here it is.  Relative references are supported now but you still need to use the "op" syntax.

 

 -G

Another question :D.

 

How the addvariablename  work?

 

int s = npoints(@OpInput1);

addvariablename("s", "S);

 

or

 

i@s = npoints(@OpInput1);

addvariablename("s", "S");

 

seems not working at all.

Link to comment
Share on other sites

it's the latter

just note that addvariablename() function works only with point wrangle, not attriwrangle

Thanks. working well.

Is it any different between the point wrangle and attribute wrangle run over point.

I don't get any useful information form help card.

:mellow:

Link to comment
Share on other sites

Thanks. working well.

Is it any different between the point wrangle and attribute wrangle run over point.

I don't get any useful information form help card.

:mellow:

 

 it can definitely be confusing..  Attribwrangle runs in CVex context,  pointwrangle runs in SOP context see :

 

http://www.sidefx.com/docs/houdini13.0/nodes/sop/attribwrangle

 

 the main difference is that in Attribwrangle you can add geometry (points, prims etC), which you can't in a point wrangle.  Also the functions to access geometry are different as you've discovered.

 

 -G

  • Like 1
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...