How to select linked element by element Id

thannaingoo.api
Advocate
Advocate

How to select linked element by element Id

thannaingoo.api
Advocate
Advocate

 Dear All,

 

How to select(highlight) the linked element by elementId?

We can select the current project element by elemnetId.

 

Thanks

Eden Oo

 

 

Reply
4,038 Views
6 Replies
Replies (6)

cwaluga
Advocate
Advocate

Selecting is not possible via the Revit API, unfortunately. But it is good that people keep asking this, since it is one of the most annoying missing feature Smiley Wink.

boris_zivkovic
Enthusiast
Enthusiast

Still no solution to this one, we can extract the ID of linked element through dynamo, but not select it.

Hope this feature gets added in next version.

0 Likes

yimin.chenTW
Alumni
Alumni

Hi @boris_zivkovic ,

 

Not sure if this is something similar to what you are looking for:

List<Reference> selectedObjs = new List<Reference>();

selectedObjs = sel.PickObjects(ObjectType.LinkedElement, "Select Linked Elements").ToList();

List<Element> selectedElements = new List<Element>();
foreach (Reference r in selectedObjs)
{
	RevitLinkInstance linkInstance = doc.GetElement(r) as RevitLinkInstance;
	Document linkedDoc = linkInstance.GetLinkDocument();
	selectedElements.Add(linkedDoc.GetElement(r.LinkedElementId));
}


foreach(Element e in selectedElements)
{
	do something...
}

 

 

Yimin Chen
Developer Consultant
Developer Technical Services
Autodesk

cwaluga
Advocate
Advocate

This solves a different problem. We want to set the selection set programmatically in linked docs. This is still not possible and probably in the top 10 of every serious developers‘ list of annoying API limitations.

0 Likes

sakwet
Enthusiast
Enthusiast

Is it possible to do this now? any updates?

0 Likes

fawzimasri7137
Advocate
Advocate

As far as I can tell this is still not possible.

my work around was to:

1- make a list of all the elements I wanted to interact with from the linked document.

2- copy these elements to my host document- using  CopyElements 

3- do whatever I needed to do with them

4- delete them from my host document.

I know this may seem time consuming, but my list was rather small.  
if you have a better method please let me know