Try to pick a beam from a linked Revit model.
I have try this:
Reference refe = uidoc.Selection.PickObject(ObjectType.LinkedElement,"Pick a Object"); this part works
but:
Element e =doc.GetElement(refe.ElementId); element name is the link model not the beam I picked
Element e =doc.GetElement(refe.LinkedElementId); error: Object reference not set to and instance of an object.
also try a solution from Joe Ye:
http://adndevblog.typepad.com/aec/2014/02/how-to-get-the-picked-element-in-the-linked-model.html
still no luck
I tab to select the linked element and use IDs of Selection but no Id return. is it possible to get the element parameters from a link? any suggestions? Thanks
Solved! Go to Solution.
Solved by Revitalizer. Go to Solution.
Hi,
the linked element resides in the linked document, not in the main document.
You say:
"Element e =doc.GetElement(refe.ElementId); element name is the link model not the beam I picked"
In fact, e is a RevitLinkInstance.
So you find the linked document this way:
Document linkedDoc = (e as RevitLinkInstance).GetLinkDocument();
And the linked element:
Element eLinked =linkedDoc.GetElement(refe.LinkedElementId);
Revitalizer
Can't find what you're looking for? Ask the community or share your knowledge.