Let's say you got document A linked in document B. I have accessed an element in B that is RevitLinkInstance (linked from A). The instance has an id 123456 but that is not an ID that is assigned to it in it's source document. How can I obtain the "original" ID of that element from doc A?
I hope this makes any sense 😄
Hi,
Are you loading the linked document with RevitLinkInstance.GetLinkDocument() method? Using a FilteredElementCollector for this document?
I thought that linked document is already loaded with the doc it is linked to. Anyway, I found a solution to my problem without using the original ID.
But the question remains, how can one do this (if it is possible)?
Example:
Document A: wall instance (ID: 123456)
Document B: column instance (ID: 111222) + wall instance (from linked doc A)
The wall instance in doc B has a different ID then in doc A. How to obtain the source/original ID (123456) ?
It surprises me to hear that the wall instance (from doc A) would have a different ID when linked into a document B. The element Id should not change and my guess is that it has not. When a linked document is opened, the link gets an ID. Then when an instance of the link gets placed to a document, that instance gets an ID too. (If it gets placed more than once, each instance would have its own ID, naturally), However, those two (or more) IDs have nothing to do with the IDs of elements in the linked document - e.g. the wall in this particular case. If one wants to find elements in a linked document, he or she first needs to get the linked document object. It can be obtained through the link instance and then the link element itself. Once the linked document is obtained, it can be used like any other Document object in Revit - that is elements can be iterated through and/or filtered. (Note: linked documents are not mutable; therefore they cannot have transactions open.)