Get Elements from open Document

Hello Dynamo Friends,

I have a script that loads a lot of different elements from another document.
I use this rhythm nodes which open the document in the background:

Problem 1: If the Dokument is already open it doesn’t work. Are there nodes to get elements from a document that is already open?

Problem 2: When i want to use the script a second time i get the error that the document is already open. So when dynamo opens it in the background once, revit believes that this document has not been closed again. I have to restart revit to get it working again.

Happy about any advice!
Kind regards :slight_smile:

Hi,

To avoid restarting Revit, add an Application.CloseDocumentFile node at the end of your graph.

You can get the document input from custom nodes that read the opened documents (Get Documents, Get AllDocuments nodes…)

2 Likes

Thank you Alban,

This sounds exactly like what i want, but I´m struggling…
I want to get elements from a document so i want to check if the source document is already open, so i can then open it in the backround or use the open document.
For that i would compare the filepath, but i can`t get the filepath of the open documents :confused:

The OOTB nodes won’t work. You can use instead the Document Properties node of the Genius Loci package.

1 Like

Wow, getting the right document was a wild ride, but it works! :smiley:
The problem is, that the filepath style of the centralfile output of your node is different to the filepath i use as input.
Input file path is like “P:\Folder1\Folder2…”
but the filepath from your node is “\\something\somethingelese\Folder1\Folder2…”