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

Hi There,
I am trying to access the Path Type from Cad links but the outcome doesn’t match with the Manage Links dialogue. What could be the issue here?

Have you changed the PathType In the links dialog and not synched?

I ran it right after opening the file.

I have tried this as well>>
Created a new project
Linked the CAD file
Changed the Path Type to absolute
Saved the Revit file
Reopened it and ran the script, but results are same.

Hi,

I tried with another method, I think it’s an API bug or 'PathType" is not really supported with CADLinkType

1 Like