Clean list from those elements that were just deleted with dynamo(empty elements)

Hello guys. I am copying voids from a linked file, then cutting walls with them. Some of them are deleted because don’t cut anything, but I still need them in the file. What I am trying to do is to find out which were deleted to copy them again from the linked file. The problem I have is that when I tried to select voids, the list still shows the deleted voids (even though is says ‘empty’ they still have an ID and List.Clean is not working). Is it possible to filter out these deleted elements?

You might be able to use the List.FilterByBoolMask to filter the “empty” from the original list.

thank you for your reply. I try this, it didn’t work for me.

I tried to make a sample file, but there everything works well and I can not make my point. Still I forced it a bit and attach it. (revit doesnt make error: out of host, and delete the elements). [void to file2.rvt (1.5 MB)
void to file MEP2.rvt (1.7 MB)

voids to file2.dyn (84.3 KB)

Right now you’re checking the list of elements for “empty”, which is just a string. You’ll have to convert your element list to a string first, and then use String.Substring to check for anything containing “empty”.

1 Like

Check at the level of your list for empty lists this way maybe (if they are empty, it looks like your empty list has an Id which makes me think it’s an element and not empty?). Otherwise I’d go with Nick’s method to check for the name of the element if it’s always the same.

Hello. Sorry for the late reply. I have tried both @GavinCrump @Nick_Boyts solutions. But still not working. It is uncommon. Is it because it takes about a minute to finish running? or because I use dictionaries? I can’t tell that other different thing I tried this time.


Odd that it’s still returning the element when converting to a string. You might try adding a Transaction.End node after Tool.RunMe just to be sure.

If you’re copying all the elements from a link, couldn’t you just look at the original list of elements and manually compare indices? I know it’s not an automated task, but it should at least get you settled for now. In the long run, you would probably want to check your possible voids first and filter out any that won’t cut anything. It’s better to handle this issue before it happens rather than after.

It worked! thank you very much @Nick_Boyts. And thank you @PedersenJPP and @GavinCrump for giving a help.

Thank you for the solution and for suggesting other options. I was thinking to break the process in two files. But this solutions is smoother, I am happy for it.