Grasshopper

algorithmic modeling for Rhino

Hello Hello

 

Maybe I'm missing somthing with how "Item Index" works..   Shouldn't the output in this example be "B"?

 

What am I missing?

 

 

 

Views: 25405

Replies to This Discussion

Hi Carl,

 

you want [List Item]. [Item Index] tries to find the item (in your case the text "1") in the list {A, B, C}, cannot find it and thus returns -1.

 

You don't want to use [Item Index] unless you really know what you're doing. [Member Index] tends to work much better.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

David

 

Thanks for the hint about [Member Index], and while I am what I would call an "intermediate" user of Grasshopper, I am always looking to get better... so, perhaps you (or someone) could provide a small example of how one would use [Item Index]?

 

I've tried setting up a scenario that would work the way you described...but no luck.

 

I might be missing what the difference is between the term "member" and "item", otherwise, what's the difference between [Member Index] and [Item Index].

 

Thanks for your patience...still learning...

This came up the other day. Read through this thread to see if you get a better understanding of why Item Index is not working how you expected.

 

Hi Carl,

 

the difference between [Member Index] and [Item Index] is basically that Member Index compares values, whereas Item Index compares memory addresses.

 

So why would you ever need Item Index you ask? Because Member Index can only handle simple data types (numbers, text, points etc.) and also because you might need very specific variable mapping which is not possible when a list contains the same value more than once.

 

But all in all you will (almost) never need Item Index.

 

--

David Rutten

david@mcneel.com

Leusden, Holland

Hello David

I think that is what you were looking for:

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service