Get Linked CAD Path Type from Revit

How do I get the Linked CAD Path Type – Absolute/Relative?

I’m using the below code to get the PathType of Revit links but it gives an error for CADLinkType.

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File "<string>", line 22, in <module>
AttributeError: 'CADLinkType' object has no attribute 'PathType'
import clr
import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)
import os
import ntpath
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc =  DocumentManager.Instance.CurrentDBDocument
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *
def tolist(obj1):
    if hasattr(obj1,"__iter__"): return obj1
    else: return [obj1]
rvtLinkTypes = tolist(UnwrapElement(IN[0]))
outList = []
for rlt in rvtLinkTypes:
    if rlt:
        outList.append(rlt.PathType)
    else:
        outList.append(None)
OUT = outList

The PathType property does not exist for Cad Links.

https://www.revitapidocs.com/2022/022bd2d6-482e-47c7-438d-74f86a322f52.htm

You can use the ExternalFileReference class to help.

2 Likes