Why is indexof and/or == not working


#1

What am I doing wrong

I defined a point.bycoordinates (x=7500, y=2500, z=0) now i want to check if this point is in the list an what it’s index is.
The list is a list of points (point.Bycoordinates) [1] is the one we need.
But index of is saying the point doesn’t exists and the == is saying that all the pionts match, or am I seeing it wrong.

This logic is a lot harder then i thought.

dynamo_indexof


#2

For the second one, I believe that ‘==’ can only process one input, not a list. If you want to use it for a multi-item input, use a formula node with the following:

a==b

And it should work.

You’ll have to use List.Map for the IndicesOf as it will have to be mapped over an entire list. Try searching for some posts by Andreas Dieckmann on the forum and they should point you in the right direction (Similar to the above logic in terms of mechanics).


#3

I was just having a similar problem with IndexOf. This node works with a list as input, so there’s no need to use List.Map, correct? However it returns an integer, not a list as the output, so you only get the first occurrence. I have no clue how to retrieve the list of occurrences. Here’s a simple example that I can’t figure out:

IndexOf

As for the == node: since it has lacing options, doesn’t that imply it works on lists?


#4

List.AllindicesOf was in the latest daily. I don’t know how long its been around…

List All Indices Of


#5

Thank you for your contribution.

Sol the hint on the formula gives me al list of null’s

But i found the solution in this post, couldn’t find it yesterday

http://dynamobim.com/forums/topic/find-index-of-matching-value-in-sublist/

the last reply of <span class=“author-link”>Dimitar Venkov</span> works.


#6

I thought lacing of IndexOf was fixed in 0.8.1 but it has not.


#7

Yes, I’m trying to use it in a Code Block, but it doesn’t works neither.

IndexOf


#8

Thanks for the tip, Rafael.