RevitLinkType Name not equal to Application.Documents.Title in BIM360?

RevitLinkType Name not equal to Application.Documents.Title in BIM360?

jkbi
Enthusiast Enthusiast
1,167 Views
3 Replies
Message 1 of 4

RevitLinkType Name not equal to Application.Documents.Title in BIM360?

jkbi
Enthusiast
Enthusiast

Hi;

 

I've used just for years the code from https://adndevblog.typepad.com/aec/2012/10/accessing-data-from-linked-file-using-revit-api.html.

IList<Element> elems = collector
        .OfCategory(BuiltInCategory.OST_RvtLinks)
        .OfClass(typeof(RevitLinkType))
        .ToElements();

      foreach (Element e in elems)
      {
        RevitLinkType linkType = e as RevitLinkType;
        String s = String.Empty;

        foreach (Document linkedDoc in uiApp.Application.Documents)
        {
          if (linkedDoc.Title.Equals(linkType.Name))
          {

 But it seems that the linkedDoc.Title can be different from linkType.Name for files on BIM360? Does this happen if user changes the name of the Revit file on BIM360? or how...

And does it mean on have to use GUIDs/IDs instead?

Accepted solutions (1)
1,168 Views
3 Replies
Replies (3)
Message 2 of 4

Chuong.Ho
Advocate
Advocate

try fix with  linkType.Name.Replace(".rvt", string.Empty);

Chuong Ho

EESignature

0 Likes
Message 3 of 4

jkbi
Enthusiast
Enthusiast

🙂 if was just so simple - i'm doing something like that already - the problem is that file start like XXXXXX.rvt but after rename it is YYYYYY.rvt in BIM360 UI, but remains XXXXXX.rvt in skyscraper (it seems)

0 Likes
Message 4 of 4

jkbi
Enthusiast
Enthusiast
Accepted solution

I looked into RevitLookup and found this function for linkinstances - GetLinkDocument

 

So I changed the code to this instead of looping documents - and it works.

RvtDocument linkedDoc = linkInstance.GetLinkDocument();

if (linkedDoc == null) continue;