Problem using IndexOf node

Why isn’t the value being put into IndexOf being recognized?

2015-01-19_1523

Try Flattening the list of Materials before putting it into List.Map. I think “Index Of” is only seeing a list of 2 lists (an array) rather than an single list to then find that particular material.

Nelson what your seeing is correct. As you are using the List.Map node the IndexOf node becomes a function. This is the case with any List.Map example as shown below. Your problem here lies with what you are passing through the node.

Function

Nelson- not sure what you are trying to achieve, but this thread may help you.

 

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

 

Thanks guys. This must be one of those instances where values look the same to me, but actually aren’t?

@Ben, it was that thread that got me where I am. I saw passing the “cat” as a member to a list map to get the index.

The frustrating thing is, I see all the information I want coming out of the FamilyType.CompoundStructureLayers node, but I can’t get to it. I want to look in the layer materials until I match a material with one passed in. I then want to add the layer widths of all the remaining layers of the element. So in the image, the material would be found at index [4] and then I would add together the layer widths [5…7]…then on to the next element. Any suggestions? I’ve tried copying the python script used to make the FamilyType.CompoundStructureLayers node and modify it, but I break it pretty quickly. It seems as it is iterating through the layers listing materials, I should be able to check it to see if it matches a passed in value, and then start adding the widths until it adds the last layer, appends the sum to a list , resets to zero until it finds the material in the next element.

2015-01-19_1446

So I managed to get something working if I use List.GetItemAtIndex to get a single list. But I want to iterate through a series of elements, each defined by a sublist. Maybe that would be more easily accomplished in Python Script ? Maybe I should explain the image…the script output is [0] finding the material [1] the index of the material found [2] total materials in element [3] width of each material layer [4] total width of layers 4…7

2015-01-20_1508