Hi there,
I have a list sorting and matching problem that I haven’t been able to solve. and haven’t been able to find a good or clear way to sort or text match the data and be able to keep the Tree paths or list items number to sort all data
I have a list coming from excel labeled (‘List A’ which is a list of levels/floors) a list of text associated with geometries (‘List B’ slabs) and a list of heights that need to be matched to the list of geometries.
I would need to match ‘List B’ to ‘List A’ to then dispatch the matching levels + attributes to then sort the Levels in ascending order and match them to each geometry (‘slab’).
in the screen shot you can see the levels are coming all over the place from rhino inside revit.
2023-06-30_Sorting and matching lists.gh (308.2 KB)
It looks possible to associate the two lists with 27 items each, but otherwise? 72 and 80? How?
Sorting and matching lists_2023Jun30a.gh (315.3 KB)
Yeah that is what is tricky about it. the list of ‘Levels’ coming from rhino inside and the list of levels coming from the Excel sheet wont have the same number of items since the excel sheet is the one ruling the amount of geometries from revit that need to be extracted.
I tried extracting the list items with a series from excel but I need to avoid having to revised the series if an item is out of range. I tried a python definition to iterate through both lists and dispatch but wouldnt give me a perfect result. it would include geometries that are not in the excel.
2023-06-30_Sorting and matching lists v2.gh (321.8 KB)
What is more perplexing to me is that the Z coordinates in the list don’t match the Z coordinates of the surfaces…
That was my bad, matching Zs to easy your perplexity haha. I was trying to make the data trees/list a bit easier to match by reducing the number of ‘slabs’
But looking at it a bit more we can use the Z from the geometries and discard that component.
Ok, so I was able to solve the sorting of two lists with different number of items 72 & 80 +/-. And make a boolean list to then dispatch the ‘slabs’ with a python function. It took me a bit to figure out since I am still learning python but luckily is doing the trick!
If anyone out there knows of a better way to solve this I am happy to hear it since I am sure there’s got to be a way to do it with grasshopper components.