Hello everybody!
Here is a little exercise I’m doing: trying to extract materials from wall types and to have an organized list of them for each type.
Though there are empty list and null element in my list of materials. How can I get rid of these elements?
When I get rid of them, I also need to keep correspondence with the wall in Revit
Thank you, but I’m not sure it works… the problem is that now I have a random list of values that correspond to specific elements. The list of elements are family types (and it’s a list of 133 items); this random list is composed by 115 items that should be placed at their right place…
I’ll try to be more clear,
These 115 elements correspond to specific elements in a list composed by 133 elements that has been cleaned from null and empty elements. How can I recreate the correspondance in the right way after cleaning the list?
Actually the problem is that, after removing null and empty lists, the list is shorter than before, but I need not to loose the equal number of items in the two lists, in order to keep in both the lists the same order.
is working with dictionaries using a unique key (like the revit GUID) instead of ordered list an option? that´s usually a more robust approach in my opinion
If you want to keep the same number of sublists you can’t remove the empty lists. You would either have to keep them as placeholders or replace them with another list (maybe with blank values or something). You should be able to use Flatten with list levels (although I haven’t been able to tell if that’s even necessary), CleanList to remove nulls, then do whatever you want to do to the remaining empty lists.