Loop elements and do operations on each element?

Hi, does anyone know how to loop a set of given elements and do operations on each element and then get corresponding results? For example, as the picture below shows, let say I want to find all beams contacted with each slab. My strategy is that, given a set of all slabs and a set of all beams, for each slab use the Geometry.DoesIntersect node to find the desirable beams. Now I can get the intersecting beam list for each slab by selecting each slab manually, as the dynamo script screenshot shows. I am wondering are there some ways that can loop the slab list and get different lists of beams intersected with each slab automatically? Thanks!



Find contacting elements for each element.dyn (22.4 KB)
The color part is just for visualization.
Test model: https://drive.google.com/file/d/1WVDYI7dYdW52k7sRIjDL0SfpH9KCakaN/view?usp=sharing

Start learning about lists, if you feed a Node a list of elements instead of a single element, the Node will execute it’s action as many times as there are items in the list.

You will need to be more carefull with nested lists, sorting etc, but give it a try.

1 Like

Thanks for your advice! @Bjorn_Keulemans1, you reminded me about the list lacing! I found that the lacing of the Geometry.DoesIntersect node should be cross product and List.Flattern nodes should be added before it. Then I can get different intersecting beam list for different slabs.