Revit二次開發--取得鏈接文件路徑

取得鏈接到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;
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章