Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Getting original ID from linked document(s)

4 REPLIES 4
Reply
Message 1 of 5
uros3d
574 Views, 4 Replies

Getting original ID from linked document(s)

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 😄

4 REPLIES 4
Message 2 of 5
augusto.goncalves
in reply to: uros3d

Hi,

 

Are you loading the linked document with RevitLinkInstance.GetLinkDocument() method? Using a FilteredElementCollector for this document?

 

 

Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
Message 3 of 5
uros3d
in reply to: augusto.goncalves

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) ?

Message 4 of 5
arnostlobel
in reply to: uros3d

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.)

 

Arnošt Löbel
Message 5 of 5
Ning_Zhou
in reply to: arnostlobel

1) i assume these linked elements can at least be highlighted or selected in host document, isn't it?

2) if so then is it possible to tag these elements in host document?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community