I’m trying to create a tool that re-path Linked CAD. However, I am stuck on getting the file path of the import instances (it’s part of the workflow), which confuses me because I use the same method in Dynamo Python and it works…
Here is my code:
dwgs = DB.FilteredElementCollector(revit.doc)\
.OfClass(DB.ImportInstance)\
.WhereElementIsNotElementType()\
.ToElements()
for dwg in dwgs:
if dwg.IsLinked:
Ref = dwg.GetExternalFileReference()
and the error I got is “This Element does not represent an external file.”