Skip to content

Instantly share code, notes, and snippets.

Last active April 14, 2022 16:26
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
public void Action()
StringBuilder sb = new StringBuilder();
IList<Element> elements = new FilteredElementCollector(DB.Doc).OfClass(typeof(RevitLinkType)).ToElements();
foreach (Element element in elements)
string GetExtFileRefPath(Element item)
IDictionary<ExternalResourceType,ExternalResourceReference> resourceReferences = item.GetExternalResourceReferences();
foreach (KeyValuePair<ExternalResourceType,ExternalResourceReference> valuePair in resourceReferences)
var path = valuePair.Value.InSessionPath;
return path;
return string.Empty;
# Load the Python Standard and DesignScript Libraries
import clr
from Autodesk.Revit.DB import *
# Import DocumentManager and TransactionManager
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]
import clr
from Autodesk.Revit.DB import *
def GetExtFileRefPath(item):
try: return ModelPathUtils.ConvertModelPathToUserVisiblePath(item.GetExternalFileReference().GetAbsolutePath())
except: return None
items = UnwrapElement(IN[0])
if isinstance(IN[0], list): OUT = [GetExtFileRefPath(x) for x in items]
else: OUT = GetExtFileRefPath(items)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment