I’m trying to find a way to get the index of a matching value between a list and a sublist. See attached image.
Basically, i want to look for the value in index [n] in the list at index [n] of the larger array and return the matching index. So in my illustration, =5, =4,…
Have you tried the “IndexOf” node in combination with the “List.Map” node?
And if you want to search for multiple values maybe you could try “List.LaceLongest” instead of “List.Map” :
So I had this working great a few weeks ago, but now when I try to recreate it, it does not work. I just updated to 0.7.5, but I dont think that is the problem. See attached image…why is this returning all -1.00? Not that my files created with 0.7.4 still work fine, but this does not work at all.
I think I misunderstood your initial intent. I thought that you want to search a list with sub-lists and get the index of the host list and the index of the sub-list. If you want to find a list of values inside a second list, try if the following works for you:
You run “List.Map” on each index of the list of searched items and map them to the searchable list.
You were trying to index non-list items and that is why you were getting -1’s. If each index in your list was a sub-list it might have worked but it would just compare cat to cat, dog to 4 and 4 to dog.
Actually, you understood my original intent (first post) perfectly. I misunderstood the application of the concept. I went back and looked at the original way I was using it and I see the difference in the two. Also, I had tried the List.Map with the Index Of feeding in as the functions, but I was feeding the second list into the “Member” part rather than the “Array” part. I think this mistake has actually helped me to understand the logic behind these few nodes better. Thank you Dimitar for your help on this. I owe you a beer if we ever cross paths.
FYI - the original post was in reference to a tool I’m building that will compare two structural models and push the beam and column sizes, reactions, etc from the second model to the first model if members are found within a set “tolerance” distance of each other. Basically, it allows for having a structural model brought in from RAM, RSA, RISA, etc push it’s design info to a documentation model without having to track GUIDs between the two models and maintain a “link” between the Revit Documentation model and the Structural Analysis model. It’s incomplete, but I have worked out the member comparison and size conversion parts and it works very well.
Glad I could help
That sounds like a very useful workflow, Ben. I guess you export your analytical data to excel first? If possible, maybe you could share a quick rundown of your process?
I’m not using any Excel or analytical model elements. I’m building this tool because we often have analytical models that are not 100% accurate in terms of member locations and are not “linked” with the Documentation models, but much of the info in the Analytical model needs to get into the Documentation model without also pushing the member location errors into the documentation model.
The assumption that I’m going on at this time is that the Structural Analysis Software (RAM , RISA, etc) has some sort of “Export to Revit” capability. Then I assume that I have two models,the model from the Analysis software that has the correct design info (member sizes, reactions, etc) and the Documentation model that has some incorrect info (member sizes and reactions) but has correct element locations. I link the model generated from Analysis into the Documentation model. Then I go to Dynamo.
In Dynamo, I compare the location of each Element in the Documentation model to the Location of Each element in the Linked Analysis model (for Structural framing and Columns, I take the average of the start and end nodes as the location). Then I take the member from the Linked model that has the “smallest” value (the member closest) and compare that “difference” value to a user specified “tolerance”. If the resulting “closest member” is within the tolerance, then I Get Parameters from the Linked Model and Set Parameters in the Documentation model.
Still a work in progress and it may or may not be useful in the long run, but I’m learning a lot as I do it (I started learning Dynamo at AU last month) and that alone is worth it to me.
This works. I made a new screenshot from that method for posterity.