In this guide we will take a look at how to work with Revit Documents and Links using Grasshopper inside Revit.

Querying Open Documents

Use the Open Documents component to query the documents that are open in Revit:

The Active Document component always refers to the currently active document. Be aware that when you switch documents in Revit interface, the output of the component will be updated to reflect the newly activated document:

Note that the document components show the target document on the label at the bottom of the component

Use the Document Identity to grab the identify information from the active document:

Document-Aware Components

Document-Aware components, can work on active or given documents. They have a hidden Document input parameter that can be added by zooming in into the component:

Once this input parameter is added, any Revit document can be passed into this input:

Here is another example of collecting wall instances from multiple source documents:

Document Properties

Use the Document File component to inspect the file properties of the given document:

Use the Document Worksharing to inspect the work-sharing properties of the given document:

Opening Documents

Work in Progress...

Saving Documents

Use the Save Document component, to save the given documents into an output file. The output file is passed to the component as a path string. Make sure that the path is ending with the appropriate file extension for the given document:

Querying Linked Documents

When Revit loads a model, it also loads all the linked models into the memory as well. Each Revit model is represented by an instance of DB.Document. The DB.Document.IsLinked shows whether the document has been loaded as a link for another document. Revit can not open two instances of the same model in a Revit session. This is the primary reason that you can not edit a linked model, without unloading it from the host model first

Use the Document Links component shown here to get all the documents that are linked into the active (or given) document

Querying Linked Elements

Use the Query Elements component shown here to access elements if a given document. The input document can be a linked document as well.

You can chain the Open Documents component into the Document Links component to grab all the linked documents from all the open documents:

Work in Progress...
Work in Progress...
Work in Progress...