# Dynamo python, open revit files from autodesk docs

**URL:** <https://forum.dynamobim.com/t/dynamo-python-open-revit-files-from-autodesk-docs/97501>\
**Category:** Revit\
**Tags:** python, acc\
**Created:** [January 25, 2024, 3:48pm UTC](https://forum.dynamobim.com/t/dynamo-python-open-revit-files-from-autodesk-docs/97501 "2024-01-25T15:48:03Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![kuomaje](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kuomaje/32/175770_2.png) [@kuomaje](https://forum.dynamobim.com/u/kuomaje)\
**Post date:** [January 25, 2024, 3:48pm UTC](https://forum.dynamobim.com/t/dynamo-python-open-revit-files-from-autodesk-docs/97501/1 "2024-01-25T15:48:03Z")

</div>

In dynamo / python, how to open revit file from autodesk docs? Seems like if it is from autodesk docs, it doesn’t really work, keep on freezing.

doc = app.OpenDocumentFile(file\_path)

Thanks!

---

<div class="post-metadata">

**Author:** ![hamid-dpr](https://avatars.discourse-cdn.com/v4/letter/h/ecccb3/32.png) [@hamid-dpr](https://forum.dynamobim.com/u/hamid-dpr)\
**Post date:** [January 25, 2024, 4:29pm UTC](https://forum.dynamobim.com/t/dynamo-python-open-revit-files-from-autodesk-docs/97501/2 "2024-01-25T16:29:25Z")

</div>

Autodesk docs can host cloud-workshared models (cloud collaboration for Revit) and drag-and-drop models that are not cloud workshared.

For cloud-workshared models you need the projectGuid and modelGuid of the model to build the modelPath. So instead of the file\_path, build a modelPath per the following link:

> **[ConvertCloudGUIDsToCloudPath Method (String, Guid, Guid)](https://www.revitapidocs.com/2024/aa710231-4cab-98ba-951f-00c72e06bb6e.htm)**
>
> Online Documentation for Autodesk's Revit API: 2015, 2016, 2017, 2017.1, 2018

For non cloud-workshared models, you need Desktop Connector and you should just pass the filePath to the Autodesk Docs drive.

How did you build the file\_path variable?

---

<div class="post-metadata">

**Author:** ![kuomaje](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kuomaje/32/175770_2.png) [@kuomaje](https://forum.dynamobim.com/u/kuomaje)\
**Post date:** [January 25, 2024, 5:05pm UTC](https://forum.dynamobim.com/t/dynamo-python-open-revit-files-from-autodesk-docs/97501/3 "2024-01-25T17:05:08Z")

</div>

Aha, thanks for your response, @hamid-dpr! It is more complicated than I anticipated.

I am trying to access a cloud-workshared models from dynamo. For the filepath I put the filepath of file from the Autodesk Docs drive:

e.g: “C:\Users\ [username] \DC\ACCDocs\ [project] \Project Files\test.rvt”

---

<div class="post-metadata">

**Author:** ![hamid-dpr](https://avatars.discourse-cdn.com/v4/letter/h/ecccb3/32.png) [@hamid-dpr](https://forum.dynamobim.com/u/hamid-dpr)\
**Post date:** [January 25, 2024, 8:08pm UTC](https://forum.dynamobim.com/t/dynamo-python-open-revit-files-from-autodesk-docs/97501/4 "2024-01-25T20:08:52Z")

</div>

Okay this sent me down the rabbit hole but I hope it helps. Lets cover a few items first.  
(1) The method that you are using is for opening the model in background and it will not be opened in the UI. I assume that is your intent.

(2) Since it is a cloudworkshared model and you were trying to open it using the desktop connector, you would have opened the “published” version of the model and not a live synchronizable model. So you have to explicate your goals (do you want to use the published content? or the live content? do you want to change/synchronize the model?). I assume you want to change/synchronize the model, so lets focus on opening the live cloudworkshared model.

(3) You need the projectGuid and modelGuid of the cloudworkshared model. You have to either grab these datapoints using the APS platform APIs (get the project, folder, items, and item data of the revit file: [https://aps.autodesk.com/en/docs/data/v2/reference/http/projects-project\_id-items-item\_id-GET/](https://aps.autodesk.com/en/docs/data/v2/reference/http/projects-project_id-items-item_id-GET/)), or you can open the model in Revit UI and use the Revit lookup add-in to get them ([GitHub - jeremytammik/RevitLookup: Interactive Revit RFA and RVT project database exploration tool to view and navigate BIM element parameters, properties and relationships.](https://github.com/jeremytammik/RevitLookup)). In Revit lookup, go to Snoop Active Document \> GetCloudModelPath, like the snapshot below.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/a/6a5bb219ebcf9d307d2e712589251fbcff5e158d.png)

(3) now that you have the modelGuid and projectGuid you need something like this in Dynamo but know your Revit version upfront, adjust your region and openOptions (e.g., worksets, etc) per your requirement, and wait for the file to download. this is the minimal version:

```auto
#your regular dynamo python Revit API imports before this line
from System import Guid
projectGuid = Guid("a1486eae-e444-44e1-bd23-e27a59aa4548")
modelGuid = Guid("1cdd691b-323a-4c43-a6ec-92f025039")

modelPath = ModelPathUtils.ConvertCloudGUIDsToCloudPath(ModelPathUtils.CloudRegionUS,projectGuid,modelGuid)
openOptions = OpenOptions()
newDoc = app.OpenDocumentFile(modelPath,openOptions)

```

However, in Dynamo, opening a cloud model in background apparently does not get rid of the Open File popup even after the model being fully loaded, and it will lock Revit UI. Not sure if this is a bug, or showed in my setup of Revit 2023, but I do not have any solution for that problem.

(4) In a Revit macro, the same approach works fine and that pop-up goes away when the model is loaded.

```auto
		public void openCloudFile()
		{
			
		Autodesk.Revit.ApplicationServices.Application app = this.Application;
		Guid projectGuid = new Guid("yourProjectGuid");
		Guid modelGuid = new Guid("yourModelGuid");
		ModelPath modelPath = ModelPathUtils.ConvertCloudGUIDsToCloudPath(ModelPathUtils.CloudRegionUS,projectGuid,modelGuid);
		OpenOptions openOptions = new OpenOptions();
		
		Document newDoc = app.OpenDocumentFile(modelPath,openOptions);
		}

```

(5) Close the file after your workflow using the newDoc.Close() method. Otherwise, it will remain open in the background and potentially cause other problems.

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [January 25, 2024, 8:35pm UTC](https://forum.dynamobim.com/t/dynamo-python-open-revit-files-from-autodesk-docs/97501/5 "2024-01-25T20:35:16Z")

</div>

I recommend pulling the model GUID and project GUID via APS (Autodesk Platform Services, formerly known as Forge).

For use of the APS APIs calls you can review the tutorials and other documentation here: [https://aps.autodesk.com/en/docs/data/v2/tutorials/download-file/](https://aps.autodesk.com/en/docs/data/v2/tutorials/download-file/)

I believe that the combination of “download file” and “publish a Revit model” should get you what you are after. Going another route will require manually finding the model GUID for each new cloud worksharing model.

---

<div class="post-metadata">

**Author:** ![kuomaje](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kuomaje/32/175770_2.png) [@kuomaje](https://forum.dynamobim.com/u/kuomaje)\
**Post date:** [January 25, 2024, 8:55pm UTC](https://forum.dynamobim.com/t/dynamo-python-open-revit-files-from-autodesk-docs/97501/6 "2024-01-25T20:55:22Z")

</div>

Thank you @hamid-dpr for your thorough explanation and guidance of how to get it set up!

Yes, I am trying to open the model in the background. I am trying to create a workflow for the user to select another revit file, copy and paste contents from the other revit file to the current revit file.

Seems like the Revit lookup tool can be a good starting point, and the APS will ultimately be the end goal! Thanks again for your help, much appreciated. Such a warm community 🙂

---

<div class="post-metadata">

**Author:** ![kuomaje](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kuomaje/32/175770_2.png) [@kuomaje](https://forum.dynamobim.com/u/kuomaje)\
**Post date:** [January 25, 2024, 8:56pm UTC](https://forum.dynamobim.com/t/dynamo-python-open-revit-files-from-autodesk-docs/97501/7 "2024-01-25T20:56:16Z")

</div>

Thanks @jacob.small Thank you! I agree with your comments. I will look up the APS API documentation.

---

<div class="post-metadata">

**Author:** ![ruben.romero](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ruben.romero/32/115842_2.png) [@ruben.romero](https://forum.dynamobim.com/u/ruben.romero)\
**Post date:** [January 26, 2024, 12:31am UTC](https://forum.dynamobim.com/t/dynamo-python-open-revit-files-from-autodesk-docs/97501/8 "2024-01-26T00:31:55Z")

</div>

Let us know what solutions you find because i asked the same years ago in this forum and i forgot about absolutely 💯

---

<div class="post-metadata">

**Author:** ![kuomaje](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kuomaje/32/175770_2.png) [@kuomaje](https://forum.dynamobim.com/u/kuomaje)\
**Post date:** [January 30, 2024, 3:40pm UTC](https://forum.dynamobim.com/t/dynamo-python-open-revit-files-from-autodesk-docs/97501/9 "2024-01-30T15:40:05Z")

</div>

Hmm, seems like it is stuck on opening. Is there a reason why it might happen? Thank you all in advance! 🥲 🙄

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/f/0fc6dfc966a7e68ffed4289b7b2ccf5cf5b6d70d.png)

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [January 30, 2024, 6:57pm UTC](https://forum.dynamobim.com/t/dynamo-python-open-revit-files-from-autodesk-docs/97501/10 "2024-01-30T18:57:03Z")

</div>

Might have rate limited yourself, or you are lacking space on your C drive, or your personal accelerator is full, or you just have a lot of files. The journal for Revit should provide some insight.

---

<div class="post-metadata">

**Author:** ![kuomaje](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kuomaje/32/175770_2.png) [@kuomaje](https://forum.dynamobim.com/u/kuomaje)\
**Post date:** [January 30, 2024, 7:28pm UTC](https://forum.dynamobim.com/t/dynamo-python-open-revit-files-from-autodesk-docs/97501/11 "2024-01-30T19:28:38Z")

</div>

Thank you!

---

<div class="post-metadata">

**Author:** ![Deep](https://avatars.discourse-cdn.com/v4/letter/d/ce7236/32.png) [@Deep](https://forum.dynamobim.com/u/Deep)\
**Post date:** [April 10, 2024, 11:05pm UTC](https://forum.dynamobim.com/t/dynamo-python-open-revit-files-from-autodesk-docs/97501/12 "2024-04-10T23:05:06Z")

</div>

Alternatively, you can also use **Bird Tools** Plugin from Autodesk App Store to run Dynamo Script/s to multiple models RFA/ RVT also from Cloud, like in the image below. I would say, it works quite well. It also has the option to SYNC after the operation. One problem that I face sometimes, is that, if there’s a warning while opening the model for which you have to click OK manually, then it waits for your mouse click to proceed further and the further automation process is halted, and it only continues when you click OK. It’s also a free plugin. Otherwise, I find it useful for batch operations to be done for Workshared Models.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/0/7093afaedbd2986b53c7af9fbfb15a4a39647adc.png)

---

<div class="post-metadata">

**Author:** ![saju\_autodesk](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/saju_autodesk/32/61838_2.png) [@saju\_autodesk](https://forum.dynamobim.com/u/saju_autodesk)\
**Post date:** [September 11, 2024, 3:09pm UTC](https://forum.dynamobim.com/t/dynamo-python-open-revit-files-from-autodesk-docs/97501/13 "2024-09-11T15:09:04Z")

</div>

@kuomaje Did you get to solve this issue ? I am struck here too.
