Filter by boolean mask empty lists

Hi everyone and apologies if this has been discussed, I haven’t found anything that would match my particular problem.

I have a Shop Drawing coworker using an instance shared parameter (Wall Name) to identify each wall in Revit with a unique name. He is using this parameter to tag the wall in some views. On the other hand, he builds collections of studs and then groups them as Model Groups, and names the model group with a unique name. I noticed that the stud panel names’ last characters matched the Wall Name, so my intention is to extract the Model Groups “Type Name” parameters as strings, and then extract what I need from those, to finally input the corresponding results into each Wall Name field. To do this I must perform an Element Intersection with Bimorph, what I’ve done is selecting one stud from each stud panel, and then clash using element Intersects Element (all the selected studs vs all walls in the model). Then I noticed that in some occasions, studs touch 2 different walls when they are at corners and there are only 2 studs in the panel. So I counted the lists of walls each stud intersects with, and filtered by boolean mask when the count at that list level was greater than one. Up to here everything worked well, out of 4029 studs originally selected, I got an “in” output of 289 that did interact with more than one wall, I would take care of those later, the thing is, that for the “out” output, well I would have expected to get 3740 indexes, but instead I am getting 3725, so there are 15 cases where I get additional empty lists from the filter, I just have run out of ideas, maybe it’s a lacing setting, levels, etc, but I believe I’ve tried them all and nothing works, can anyone chime in, it would be very appreciated.

Have you tried the node List.IsEmpty into another Boolean filter?

Hi Daan, thank you. I have tried everything, the thing is that I actually need the output to come with empty lists if I want to keep the list structure, i have to tie this data to the list of selected studs.

Now, what are the odds, I swear this is real, I have been fighting this script for about 8 hours straight, the minute I post my thread, I went back to the script and I changed the list input in the List.FilterByBoolMask to read level 1 instead of level 2. And now the numbers match

The script still doesn’t work, but this part seems solved, I am sorry I took your time, really, it just happened as I described. I appreciate your help