Filter a list that has values by index

Forgive me as this might be a really simple solution but i am not able to solve it. Is there a way to filter a list and get the index value of what has data and what does not? Here is an example list I am looking at. Not sure if it matters, but this is a Geometry.Intersect node result. Here is a screen shot of this node. I want to get the indexes of elements that intersect the structure so I can set parameters for just these.

image

You could use List.IsEmpty and List.AllIndicesOf like so:

2 Likes

Thanks Amy!!! I knew there was an easy solution… moving forward now with my script

1 Like

Follow up to this… that works for an “Empty List” but now do i get same the information(indexes that contain data) if the list is “Null”
image

Use the List.Clean OOTB node. By looking at your image, you might need to use list levels.

Renzoj14
I tried that and I can get to the indexes that have values, but I am looking to find the indexes that contain values so i can sort another list by this index number. I think it is failing because as Amy suggested above, use the list.isempty does not know what to do with the “null” values. Is there another node that will do this?

image

Dose Object.IsNull help?

Steven
I tried that as well. Still cannot get what i need. I need a way to get the index of any element that has coordinates, so in the case above, I need to filter this list and get index 7. The original solution Amy provided above worked until my list started getting “null” values in it, and now it fails.

I feel like there might be a simpler way, but maybe not without Python or a package custom node :thinking: works though ¯\_(ツ)_/¯

4 Likes

Maybe share your script? i’d like to understand why list returns in such manner.

Amy solved it again!! Two in a row today. Thank you Amy.
Renzoj14

It is from a Geometry.Intersect Node and some elements don’t intersect, so I get “null” and “empty list” values… not sure exactly why