Jump to content
probiner

How to use len() ?

Recommended Posts

So here's a simple index array on which I try to get the lenght of in Attribute Wrangle. But it throws an error like it wants vectors, so I'm left wondering if this is the right function to use or the code is missing something.
Thanks.

EkjqLvu.png

Share this post


Link to post
Share on other sites

just write

i@size =len(i[]@parm);

I must admit that houdini and arrays it's a big story.

  • Like 2

Share this post


Link to post
Share on other sites

There is one more function called  arraylength that returns length of an array 

Share this post


Link to post
Share on other sites
9 hours ago, sadhu said:

There is one more function called  arraylength that returns length of an array 

That one is deprecated now though, use len() instead, in the way dedeks put it.

the "i[]" prefix to @ is just a way to cast the attribute as an integer array.
the "Ambiguous Call" warning that you get basically tells you that you need to be more specific.

see this page:
http://www.sidefx.com/docs/houdini/vex/snippets

(about 1/3rd to halfway down the page)

Edited by acey195
  • Like 1

Share this post


Link to post
Share on other sites

Thanks guys, indeed when reading mestela's wiki I've noticed him saying he always forgets to initiate them and I didn't get it at the time, because I thought it only meant for new attributes, not custom ones which signature is not well established.

 

On 6/8/2017 at 9:08 AM, acey195 said:

see this page:
http://www.sidefx.com/docs/houdini/vex/snippets

(about 1/3rd to halfway down the page)

Cheers!


 

On 6/7/2017 at 7:57 PM, dedeks3000 said:

I must admit that houdini and arrays it's a big story.

Yeah I'm wondering if I'm going the right path with my approach. Also with the fact from what I can see, you have to go outside VOP or Attribute Wrangle to change the context of data (point, vertex, prim, detail) is a bit disheartening.

Edited by probiner

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×