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: 

possible to Pick elements of a linked Revit model and return its parameter?

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
glenncai
2280 Views, 2 Replies

possible to Pick elements of a linked Revit model and return its parameter?

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

 

 

Capture.JPG

 

2 REPLIES 2
Message 2 of 3
Revitalizer
in reply to: glenncai

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




Rudolf Honke
Software Developer
Mensch und Maschine





Message 3 of 3
glenncai
in reply to: Revitalizer

Works like a charm, Thanks

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

Post to forums  

Autodesk Customer Advisory Groups


Rail Community