How Revit recognizes and indexs Duplicate?

Maybe not…

Without getting into the API either.

  • Take the first item out of each list using a List.FirstItem set to @L2, and if needed use a List.Flatten node to clear any sublists.
  • Convert those elements into ids so they are compatible using an Element.Id node.
  • Take the second item from each list using a List.LastItems set to @L2 and if needed use a List.Flatten node to clear any sublists.
  • Group all the elements in the second list by the element IDs in the first list.
  • Run the delete element node as desired.

A few notes: You don’t want to just delete the second item in every possible warning: likely just in the duplicate items ones (ie: walls overlap, run your code as is, and you just deleted a wall, and all hosted objects!). Add a filter for the warning type to prevent over extending the scope of deletion beyond your duplicate items.

The code above might not resolve the case of Object C being in a list with Object A and object B… or simply put the code may try to delete object C twice. Might not matter, or it might. If it does look into adding a List.Unique, a List.FirstIndexOf, and a List.GetItemAtIndex node to the canvas. Those three might not resolve the issue but they’ll be a good start!