In Revit 2014, developers can call the PickObject(ObjectType.LinkedElement) to pick element in the linked model. Many developers love that. One question is how to get the picked element. They use the ElementId in the returned Reference.ElementId cannot successfully get the target element.
Actually in along with addition of ObjectType.LinkedElement enum member, Reference class also has one new member, LinkedElementId. Through this property, you can get the right ElementId of the linked document.
Here is the minimum code fragment to show the idea.
<code>
Document docLinked = null;
Reference refElemLinked =uiDoc.Selection.PickObject(ObjectType.LinkedElement,”Please pick an element in the linked model”);
//Add code to get linked document here.
Element elem = linkedDoc.GetElement(refElemLinked.LinkedElementId);
<code>