ExternalFileReference and BIM 360 Project?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have an addin that needs to determine if a link is unloaded or not. Here is my basic code for this:
switch (rt.GetExternalFileReference().GetLinkedFileStatus()) { #if !r2015 case LinkedFileStatus.InClosedWorkset: #endif case LinkedFileStatus.Invalid: case LinkedFileStatus.NotFound: case LinkedFileStatus.Unloaded: isUnloadedLink = true; break; }
where 'rt' is a RevitLinkType object.
This seems to work fine for the most part. However I have a user with a project on BIM360 and several links that are also on BIM360 (listed in manage links as cloud links). When it gets to this location I keep getting the error:
Revit encountered a Autodesk.Revit.Exceptions.InvalidOperationException: This Element does not represent an external file.
at Autodesk.Revit.DB.Element.GetExternalFileReference()...
I have stepped through the debugger and verified that it gets the RevitLinkType object properly. I have also pulled the ID from the debugger and used 'SelectById' in the Revit UI to select it and it is indeed a link type object that is loaded and in a loaded workset. I have also tried to verify it by putting in this code block:
string extIds = string.Join(",", ExternalFileUtils.GetAllExternalFileReferences(ViewsMgr.m_activeDoc) .Select(x => x.IntegerValue.ToString()));
This gets a set of ID's, but it's only the keynote table, assembly table, and ACAD link, and the one Revit link they have that is a local path; none of the BIM360 links which makes me wonder if there is some issue with this method and the BIM360 links...
Also this is in Revit 2016. Anyone have any insight as to why this is throwing that exception?