# How to get the Revit Links file path, type, instance of Autodesk Desktop Connector BIM360 in current project document?

**URL:** <https://forum.dynamobim.com/t/how-to-get-the-revit-links-file-path-type-instance-of-autodesk-desktop-connector-bim360-in-current-project-document/75406>\
**Category:** Revit\
**Tags:** revit, python, dynamo\
**Created:** [April 12, 2022, 9:20am UTC](https://forum.dynamobim.com/t/how-to-get-the-revit-links-file-path-type-instance-of-autodesk-desktop-connector-bim360-in-current-project-document/75406 "2022-04-12T09:20:52Z")\
**Posts on this page:** 11\
**Page:** 1

<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:** [April 12, 2022, 9:20am UTC](https://forum.dynamobim.com/t/how-to-get-the-revit-links-file-path-type-instance-of-autodesk-desktop-connector-bim360-in-current-project-document/75406/1 "2022-04-12T09:20:52Z")

</div>

How to get the Revit Links **file path** (local in Autodesk Desktop Connector), type, instance?

I usually give input of file path to get the links in the files but I want to do the reverse, so I got a file opened with linked Revit files and I would like to know the file path of the linked Revit files.

currently I am using this python script to get the revit links types and instances in separate lists, but I would like to add the file path of those. The difficulty is that the saved path is a cloud path, but I would like to get the path of the Autodesk Desktop of BIM360 in my local drive instead.

For this, I tried to get the File info with clockwork package but the central path indicated is in other server which is not my local drive, cloud path, I do not have access because it is a Clarity server.

Also I tried to find Revit files paths in the local drive with the Revit file names.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/5/65806d217aac99f9e3cc93d73b1e8ffd7db4f89a.png)  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/3/635c100c0de1e0eadb75478a6c3594080a3d741f.png)

```auto
import clr

# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager

# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument

# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

coll = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_RvtLinks).WhereElementIsNotElementType().ToElements()

insts, types = [], []

for c in coll:
	insts.append(c.ToDSType(True))
	types.append(doc.GetElement(c.GetTypeId()))

OUT = [insts,types]

```

---

<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:** [April 12, 2022, 12:28pm UTC](https://forum.dynamobim.com/t/how-to-get-the-revit-links-file-path-type-instance-of-autodesk-desktop-connector-bim360-in-current-project-document/75406/2 "2022-04-12T12:28:25Z")

</div>

Check the ExternalFileReference class, in particular this method : [GetAbsolutePath Method](https://www.revitapidocs.com/2022/4aa39d4e-9d44-6271-aa9c-71b6ab7515ae.htm)

---

<div class="post-metadata">

**Author:** ![chuongmep](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/chuongmep/32/197537_2.png) [@chuongmep](https://forum.dynamobim.com/u/chuongmep)\
**Post date:** [April 12, 2022, 5:36pm UTC](https://forum.dynamobim.com/t/how-to-get-the-revit-links-file-path-type-instance-of-autodesk-desktop-connector-bim360-in-current-project-document/75406/3 "2022-04-12T17:36:21Z")

</div>

use like that :

```auto
# Load the Python Standard and DesignScript Libraries
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
paths = []
def GetExtFileRefPath(item):
	try :
	   dirRefs = item.GetExternalResourceReferences()
	   for i,v in enumerate(dirRefs):
	       paths.append(v.Value.InSessionPath)
	   return paths
	except Exception as e: return e.ToString()
doc = DocumentManager.Instance.CurrentDBDocument
items = FilteredElementCollector(doc).OfClass(RevitLinkType).ToElements()
OUT = [GetExtFileRefPath(x) for x in items]

```

[Home.dyn](https://forum.dynamobim.com/uploads/short-url/gswCxa1h3fdvvPTMpTp2Pchuu8c.dyn) (3.5 KB)

---

<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:** [April 13, 2022, 9:04am UTC](https://forum.dynamobim.com/t/how-to-get-the-revit-links-file-path-type-instance-of-autodesk-desktop-connector-bim360-in-current-project-document/75406/4 "2022-04-13T09:04:48Z")

</div>

> [@chuongmep](#):
>
> like that

hello @chuongmep many thanks, I tried and result is same list of path of the revit linked files in current project, but if I got 20 links this list is repeated 20 times, I just need one path by Revit file

---

<div class="post-metadata">

**Author:** ![chuongmep](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/chuongmep/32/197537_2.png) [@chuongmep](https://forum.dynamobim.com/u/chuongmep)\
**Post date:** [April 13, 2022, 9:19am UTC](https://forum.dynamobim.com/t/how-to-get-the-revit-links-file-path-type-instance-of-autodesk-desktop-connector-bim360-in-current-project-document/75406/5 "2022-04-13T09:19:20Z")

</div>

you can try modify function `GetExtFileRefPath` return a path in fist index value of dictionary, it will be work in case of you.

---

<div class="post-metadata">

**Author:** ![chuongmep](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/chuongmep/32/197537_2.png) [@chuongmep](https://forum.dynamobim.com/u/chuongmep)\
**Post date:** [April 13, 2022, 9:25am UTC](https://forum.dynamobim.com/t/how-to-get-the-revit-links-file-path-type-instance-of-autodesk-desktop-connector-bim360-in-current-project-document/75406/6 "2022-04-13T09:25:47Z")

</div>

Like that :

```auto
# Load the Python Standard and DesignScript Libraries
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
paths = []
def GetExtFileRefPath(item):
	try :
	   dirRefs = item.GetExternalResourceReferences()
	   for i,v in enumerate(dirRefs):
	       return v.Value.InSessionPath
	except Exception as e: return e.ToString()
doc = DocumentManager.Instance.CurrentDBDocument
items = FilteredElementCollector(doc).OfClass(RevitLinkType).ToElements()
OUT = [GetExtFileRefPath(x) for x in items]

```

---

<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:** [April 13, 2022, 10:15am UTC](https://forum.dynamobim.com/t/how-to-get-the-revit-links-file-path-type-instance-of-autodesk-desktop-connector-bim360-in-current-project-document/75406/7 "2022-04-13T10:15:43Z")

</div>

> [@chuongmep](#):
>
> Like that :
> 
> ```auto
> 
> ```

it looks great, I am looking the result of the last script, aparently the list of link paths are sorted alphabetically but it is not the case in some file paths. Would it be possible to give to the python script an input of revit link types/instances?

I noticed file directories appear as “/” instead of “\”

---

<div class="post-metadata">

**Author:** ![chuongmep](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/chuongmep/32/197537_2.png) [@chuongmep](https://forum.dynamobim.com/u/chuongmep)\
**Post date:** [April 13, 2022, 10:38am UTC](https://forum.dynamobim.com/t/how-to-get-the-revit-links-file-path-type-instance-of-autodesk-desktop-connector-bim360-in-current-project-document/75406/8 "2022-04-13T10:38:16Z")

</div>

you can use GetTypeId Method if want get from revit link instance.

> **[GetTypeId Method](https://www.revitapidocs.com/2022/cc66ca8e-302e-f072-edca-d847bcf14c86.htm)**
>
> Online Documentation for Autodesk's Revit API: 2015, 2016, 2017, 2017.1, 2018

with path in bim360, you can use origin path to connect with forge hub or some thing relative path, why we need care “/” or “\” ?

---

<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:** [April 13, 2022, 10:42am UTC](https://forum.dynamobim.com/t/how-to-get-the-revit-links-file-path-type-instance-of-autodesk-desktop-connector-bim360-in-current-project-document/75406/9 "2022-04-13T10:42:43Z")

</div>

> [@chuongmep](#):
>
> GetTypeId

the script shown at the beggining is using this, but I would like to get the file path associated to each revit link type/instance

---

<div class="post-metadata">

**Author:** ![chuongmep](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/chuongmep/32/197537_2.png) [@chuongmep](https://forum.dynamobim.com/u/chuongmep)\
**Post date:** [April 14, 2022, 6:17am UTC](https://forum.dynamobim.com/t/how-to-get-the-revit-links-file-path-type-instance-of-autodesk-desktop-connector-bim360-in-current-project-document/75406/11 "2022-04-14T06:17:06Z")

</div>

I don’t understand what you want because it similar, you can see some example like that in case you want try check for types and instances of rvtlinked

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

---

<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:** [April 14, 2022, 11:21am UTC](https://forum.dynamobim.com/t/how-to-get-the-revit-links-file-path-type-instance-of-autodesk-desktop-connector-bim360-in-current-project-document/75406/12 "2022-04-14T11:21:01Z")

</div>

> [@chuongmep](#):
>
> don’t understand what you want because it similar

I agree it is very similar but how to know what Revit link type or instance is part of the script output? I would create a sublist first of revit link type/instances and other sublist of revit link paths, so I can create a dictionary. Following your last script screenshot would be something like: OUT=[instances,types,linkInstancePath,linkTypePath]
