algorithmic modeling for Rhino
I need to extract the position of a certain point in a list of coordinates. I have been using the list index. I know this question has been asked but the advice was a bit vague about comparing it with DNA searching. Can someone shed any light on how to do a search without having to write a VB code. What is the list index used for if it does not work as a search tool.
This probably exceeds my beginning knowledge level, but it sounds like an interesting issue.
What do you mean by "lost of coordinates"? List of points?
And that position of a point you are mentioning as a criteria? What exactly do you mean by point position? Particular value of x,y or z component of some point?
An index isn't something that is assigned or stored. Items in a list are stored in a specific order, you use an index to access a specific item in a list.
There are two 'search' components in Grasshopper and they work in different ways.
[Sets.List.Item Index] will locate an item in a list. It will return the index at which the item appears or -1 if the item does not occur in the list. The comparison used is memory addresses. Meaning you must supply the same item as is present in the list. This means it works on all data types, but it often confuses people because they expect the number 5 to be equal to the number 5, regardless of where those two numbers are stored in memory.
If you're merely comparing values rather than specific items, you can use [Sets.Sets.Member Index], it only works on simple data types (numbers, booleans, points, vectors, but not on curves, meshes, breps) but it compares not the memory address, but the memory contents. So the value 5 really is identical to 5, no matter where it comes from.
Most of the time the [Member Index] component is the one you're after, but every now and again you need to figure out what permutations a list of values went through and in that case [Item Index] will save the day.
OK I got the member index doing what I wanted to do. Many thanks for your prompt response even though you are officially on a well deserved break. Congratulations on your award.
Meh, it's a working trip and my train doesn't actually leave for another good 10 hours.