Is it possible to regroup a list of elements based on a different list structure?
I have a list of 39 Points © each Point is contained into a specific Bounding Box (B) there are 60 of them in total. I also have a list of 60 codes for each Bounding Box (A).
How can I regroup list © in a way that allows me to assign the corresponding code (A) to its specific point?
Thank you so much.
List © seems to contain a list of bounding boxes not a list of point some confusion there. Please clarify.
However, if © represents a list of bounding boxes that contain each point, then here is the logic that should help.
I am assuming the order of List (A) matches up with List (B). If that is the case, use the “Index Of” node to get the index value of list © elements in List (B). When you get all 39 index values, use the “Get Item” node to retrieve the corresponding elements in List (A) at those index values. That is one way.
The other way is to go the boolean route. Using the “Contains” node, test if elements in List © is contained in List (B). Use the boolean values to filter List (A).
Hope this helps.
@narella1 See if the the attached definition works for you. Also attached is an example Revit file
However, the values are written to Comments and not Mark
DoorLabelByGrid.dyn (27.0 KB)
DoorLabelByGrid.rvt (1.4 MB)
The above script does this …
Note that the value in Comments depends on the proximity of the door to the various grid intersections
Thanks for your time and comments. The issue was solved with a combination of your comments so thanks all so much!