Issue
I need a way to "purge" all the unreferenced documents. Is there a method available to do this?
Solution
The Documents.CloseAll() method has a Boolean parameter which indicates whether to close only the unreferenced documents. By default the value is false and closes all the documents. Following is the excerpt from the help file explaining the Boolean parameter UnreferencedOnly.
“Public Sub CloseAll( Optional ByVal UnreferencedOnly As Boolean = False)
UnreferencedOnly
Optional input Boolean that indicates whether to close only the unreferenced documents. If not specified, a value of False is assumed and all documents are closed.
Examples of unreferenced documents:
Create a new assembly, place an instance of a part "block.ipt" and then delete the instance in the assembly. At this point, block.ipt is an unreferenced document. Set the Suppressed property of a ComponentOccurrence to True within an API Transaction (or a ChangeProcessor). Assuming that the document that this occurrence was referencing is not referenced elsewhere, it becomes an unreferenced document.

Leave a Reply