Access to Linked File Geometry

Here are some notes on accessing the geometry of imported or linked files from a case handled by my colleague Joe Ye:

Question: How can I access the geometry of imported or linked Revit RVT, AutoCAD DWG, and SketchUp SKP files?

For instance, I have created a file Wall.rvt containing a wall and use Import/Link to insert it into LinkWall.rvt. Now, when traversing the entities of LinkWall.rvt, I see an Autodesk.Revit.Element.Instance using a Symbol which seems to be the imported or linked Wall.rvt file. How can I access the elements from the Symbol so that I can recursively traverse the imported/linked file? Furthermore, how can I do the same for an imported or linked SketchUp or DWG file?

Answer: Each imported or linked Revit project generates a document instance in the Revit Application object's document collection Application.Documents. Each imported RVT file maps to one document. You can determine the document name from the symbol, and then traverse all documents in the collection to find the appropriate one. From the corresponding document instance, you can access its elements in the usual way, for instance using Document.get_Element or Document.get_Elements. Unfortunately, we currently have no solution for resolving the issue of two identically named linked files.

With regard to imported DWG or SKP files, there is no way to access elements in the imported or linked file.

For more details on these steps, please refer to the preceding discussions on linked files, how to hide them, and listing their elements.