Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to select linked element by element Id

6 REPLIES 6
Reply
Message 1 of 7
thannaingoo.api
3350 Views, 6 Replies

How to select linked element by element Id

 Dear All,

 

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

We can select the current project element by elemnetId.

 

Thanks

Eden Oo

 

 

6 REPLIES 6
Message 2 of 7
cwaluga
in reply to: thannaingoo.api

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.

Message 3 of 7

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.

Message 4 of 7

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
Message 5 of 7
cwaluga
in reply to: yimin.chenTW

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.

Message 6 of 7
sakwet
in reply to: cwaluga

Is it possible to do this now? any updates?

Message 7 of 7

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Customer Advisory Groups


Rail Community