Revit API

Reply
Contributor
12 Posts
1 Kudo
Registered: ‎06-29-2012
Post 1 of 5

Element ID

256 Views, 4 Replies
10-02-2012 08:58 PM

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 );

Mentor
174 Posts
41 Kudos
Registered: ‎04-01-2011
Post 2 of 5

Re: Element ID

10-03-2012 02:38 AM in reply to: mohammadarslan

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

Contributor
12 Posts
1 Kudo
Registered: ‎06-29-2012
Post 3 of 5

Re: Element ID

10-03-2012 02:41 AM in reply to: ollikat

i am trying to do selection using Element Id . 

 

But its not working !

Mentor
174 Posts
41 Kudos
Registered: ‎04-01-2011
Post 4 of 5

Re: Element ID

10-03-2012 02:49 AM 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);

 

Contributor
12 Posts
1 Kudo
Registered: ‎06-29-2012
Post 5 of 5

Re: Element ID

10-03-2012 02:51 AM in reply to: ollikat

ok thankyou so much !  I will try again. 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!