Im new to the Revit API. I can get the Revit link instance using C# with the code below.
Element e = doc.GetElement(r);
if (e is RevitLinkInstance)
{
//Get revit link instance
RevitLinkInstance linkInstance = e as RevitLinkInstance;
LinkedDocument = linkInstance.GetLinkDocument();
//Do something
}
How do i get the LinkInstance using python. What i have tried so far.
element = doc.GetElement(ref)
if element is RevitLinkInstance:
linkInstance = #need to get link instance here#
linked_document = linkInstance.GetLinkDocument()
Would appreciate the help.
Your C# sample statement e as RevitLinkInstance
performs a .NET cast. Hence, you can answer this question by searching the Internet for .net cast python, leading, e.g., to the question and answer can you typecast a .NET object in IronPython? The suggestion given there is to use
import clr
convertedObject = clr.Convert(someObject, someType)