Hi @G60Dubs. If multiple components are found which referencing the same document, then which one should be kept, while all others are deleted? Are any of them constrained yet? If the first one is not constrained, but a second or third instance is constrained, but the code only keeps the first instance, and deletes all others, then your constraints will be lost. Also, are you talking about duplicates per entire structure of all levels of the assembly, or only duplicates per top level, or duplicates per sub assembly? What I mean is...if a single top level component is referencing Part1, and a single component down within a sub-sub assembly is also referencing Part1, then should that component within the sub-sub assembly be deleted or kept? What if two different components are both referencing the same model file, but one is set to a different ModelState than the other? Should the second one encountered, that is set to a different ModelState be deleted or kept?
Edit: I just attached 2 iLogic rule examples that will both attempt to delete all but the first component found within the entire structure of the assembly that references each unique referenced document, in two different ways. These examples do not pay attention to any constraints, representation differences, or ModelState differences. Keep in mind that if a code like is used on a large assembly, it can effect many different referenced documents, so be cautious and only test on files that are not important at first, to be safe.
Wesley Crihfield

(Not an Autodesk Employee)