Convert RevitLinkInstance to Element

Convert RevitLinkInstance to Element

mehdi.blanchard
Enthusiast Enthusiast
591 Views
1 Reply
Message 1 of 2

Convert RevitLinkInstance to Element

mehdi.blanchard
Enthusiast
Enthusiast

I extracted linked walls from a View using a CustomExporter 2D. From the exporter the walls are just seen as Elements:

public RenderNodeAction OnElementBegin2D(ElementNode node)
{
    Element e = node.Document.GetElement(node.ElementId);
    ...
    return RenderNodeAction.Proceed;
}

 

To be able to dimension them I need these Elements to be converted to RevitLinkInstances so that I can get the correct reference.

 

To convert from a RevitLinkInstance to an Element I did:

RevitLinkInstance link = e as RevitLinkInstance;
Document linkedDoc = link.GetLinkDocument();
e = linkedDoc.GetElement(r.LinkedElementId);

 

But how do you convert from an Element to a RevitLinkInstance?

 

Thanks!

0 Likes
592 Views
1 Reply
Reply (1)
Message 2 of 2

AGGilliam
Collaborator
Collaborator

I just searched RevitLinkInstance on the SDK (which you can find here), and found this:

RevitLinkInstance.Create(document, elementId);

 

0 Likes