Linking Distance value back to Element Geometry

I created 4 nested lists by extracting the distance of multiple elements to the nearest panel family. My process was this

  1. Get distance between each family to each panel family
  2. Compare the values at each index number in nested list to the same index number in the other nested lists and finding the smallest value.
  3. Smallest value remains in its respective list while the others are removed.
  4. New list shows the smallest distance of elements to their respective panels.

My question is, how do I link these values back to the elements geometry and update their parameter values? Please see the attached script.

Thank You

You have selected the 4 panels at the start of the graph - the result is divided into a list of 4 items. This is close to where you want to be

When you choose the minimum and flatten the lists you loose the index which matches with the associated panel.

Below I have used the minimum value with a List.IndexOf and then List.GroupByKey to associate the device to the panel - then it’s a matter of adding the information you require with a Element.SetParameterByName. Please note your image was missing node titles - it is helpful when there is the most information available

1 Like