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: 

Element ID

4 REPLIES 4
Reply
Message 1 of 5
mohammadarslan
418 Views, 4 Replies

Element ID

Can anyone please tell me, why this code is not working for Revit 2013 ?

 

 

Document^ doc = commandData->Application->ActiveDocument;
ElementId id;
id.Value = 132059;
Autodesk::Revit::Element^ selElement = doc->Element[id];

Selection^ sel = doc->Selection;
sel->Elements->Add(selElement );

4 REPLIES 4
Message 2 of 5
ollikat
in reply to: mohammadarslan

Could you be a bit more specific...how it's not working? Exception? Selection not updating?

Message 3 of 5
mohammadarslan
in reply to: ollikat

i am trying to do selection using Element Id . 

 

But its not working !

Message 4 of 5
ollikat
in reply to: mohammadarslan

Some time ago I encountered something similar...I mean after adding element to selection didn't affect the document. Try following code...that's how I have managed to get it work...though it's long time ago.

m_uiApplication->ActiveUIDocument->Selection->Elements->Clear();
  
SelElementSet ^elemSet = SelElementSet::Create();
elemSet->Insert(element);    
  m_uiApplication->ActiveUIDocument->Selection->Elements::set(elemSet);

 

Message 5 of 5
mohammadarslan
in reply to: ollikat

ok thankyou so much !  I will try again. 

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community