Grasshopper

algorithmic modeling for Rhino

What is going on here:

Is this some sort of "identity" definition of equality versus a "value" definition?  The equality component says that the third item of the list is equal to 3.0, but if you look for the same 3.0 in the list it claims not to find it in the Item Index component.  On the other hand, if you pull the 3.0 from the list and then look for that 3.0 with Item Index, there it is - not surprisingly at the third element of the series.  I guess I should expect an identity problem since objects are handed in to grasshopper functions as objects but equality seems to handle the values rather than the identities.  If it is an "identity" problem, is there some way I can get Item Index to use value equality rather than identity or is there some other component which will do this for me?  I guess, obviously, I can use a C# component which is probably a bit more efficient in my case anyway, but as always, my curiosity exceeds my need to get things done.

Views: 868

Replies to This Discussion

This looks like a casting bug to me in the item index component.

I'm surprised you don't know this one David.

@Darrel searching the GH Forum for "Item Index" will turn up a plethora of answers to this age old question. Why does Item Index not work?

The crux of it is you are not searching for a value in a list you are searching for that specific item. i.e. "3" written in the panel is not the same "3" that exists in computer memory at index 3 of the list.

Try using [Find Similar Item] instead

Huh. Had no idea that the input had to be derived from the list itself. I never use Item Index myself :)

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service