GetLinkDocument() broken in 2020?

GetLinkDocument() broken in 2020?

Yien_Chao
Advisor Advisor
1,822 Views
7 Replies
Message 1 of 8

GetLinkDocument() broken in 2020?

Yien_Chao
Advisor
Advisor

hi,

 

this command works well for all version, except Revit 2020.

 

.GetLinkDocument()

 

https://www.revitapidocs.com/2020/6f81c365-15d9-06b8-48ef-df84914fec60.htm

 

anyone experienced the same?

0 Likes
Accepted solutions (1)
1,823 Views
7 Replies
Replies (7)
Message 2 of 8

Sean_Page
Collaborator
Collaborator

I have not had any issues with this and have it in several locations.

 

using (FilteredElementCollector rvtLinks = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_RvtLinks).OfClass(typeof(RevitLinkType)))
            {
                if (rvtLinks.ToElements().Count > 0)
                {
                    foreach (RevitLinkType rvtLink in rvtLinks.ToElements())
                    {
                        if (rvtLink.GetLinkedFileStatus() == LinkedFileStatus.Loaded)
                        {
                            RevitLinkInstance link = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_RvtLinks).OfClass(typeof(RevitLinkInstance)).Where(x => x.GetTypeId() == rvtLink.Id).First() as RevitLinkInstance;
                            dtLinks.Rows.Add(rvtLink.Name, link.GetLinkDocument());
                        }
                    }
                }
            }
Sean Page, AIA, NCARB, LEED AP
Partner, Computational Designer, Architect
Message 3 of 8

Yien_Chao
Advisor
Advisor

thank you for your reply.

i will do some more tests

0 Likes
Message 4 of 8

Yien_Chao
Advisor
Advisor

problem is i've tried to get document from many links (like 9-10), some works and some don't.

they are all loaded and all the worksets are open.

 

i will look further (im in Python by the way)

0 Likes
Message 5 of 8

TripleM-Dev.net
Advisor
Advisor

Hi,

 

Are any of the links from BIM360?, from Revit 2019 they need to be retrieved differently.

 

- Michel

Message 6 of 8

Yien_Chao
Advisor
Advisor

no its all on the server.

it still works fine in 2018, 2019, but somehow not perfectly in 2020.

0 Likes
Message 7 of 8

Sean_Page
Collaborator
Collaborator
Accepted solution

Is it always the same link(s) that cause the issue? Do you have the exception error it throws when it doesn't work? 

Sean Page, AIA, NCARB, LEED AP
Partner, Computational Designer, Architect
0 Likes
Message 8 of 8

Yien_Chao
Advisor
Advisor

yes always the same. i think a find my mistake! the GetDocument() was part of another code, which is use to retrieve the project base point of all links. So all this time it wasn't the getdocument but the issue was at the BuiltInCategory.OST_ProjectBasePoint .

 

I change it to basePoints = FilteredElementCollector(doc).OfClass(BasePoint).ToElements() and all works.

 

sorry for the misinterpretation

thank you for all your feedback!

0 Likes