Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to retrieve the filepath of linked CAD files that are linked in the model. I try to do this specifially for all linked files that are not revit linked models.
But so far it seems like i am not capable of retrieving the filepath of a linked (non-rvt) file (.dwg's and such).
Is it possible to get the file path of linked files trough API ?
FilteredElementCollector col = new FilteredElementCollector(doc).OfClass(typeof(CADLinkType)); foreach (Element el in col) { try { CADLinkType link = doc.GetElement(el.Id) as CADLinkType; bool isLinkedFile = link.IsExternalFileReference(); if (isLinkedFile == true) { ExternalFileReference exFiRef = link.GetExternalFileReference(); ModelPath path = exFiRef.GetPath(); string pathString; if( path.ServerPath == true) { pathString = path.CentralServerPath; } else { pathString = path.ToString(); } TaskDialog.Show("Path", "RefType: "+exFiRef.ExternalFileReferenceType.ToString() + Environment.NewLine+ "Path: " + pathString); } } catch (Exception ex) { TaskDialog.Show("Error", ex.Message); }
Solved! Go to Solution.