取得链接到Revit文件中的链接文件的路径:
public List<string> GetLinkFilePaths(Document doc)
{
List<string> listPath = new List<string>();
foreach (ElementId elId in ExternalFileUtils.GetAllExternalFileReferences(doc))
{
if (doc.get_Element(elId).IsExternalFileReference())
{
ExternalFileReference fileRef = doc.get_Element(elId).GetExternalFileReference();
if (ExternalFileReferenceType.RevitLink == fileRef.ExternalFileReferenceType)
listPath.Add(ModelPathUtils.ConvertModelPathToUserVisiblePath(fileRef.GetAbsolutePath()));
}
}
return listPath;
}