取得鏈接到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;
}