Revit API

Reply
Contributor
Posts: 12
Registered: ‎06-29-2012
Message 1 of 5 (216 Views)

Element ID

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

Distinguished Contributor
ollikat
Posts: 144
Registered: ‎04-01-2011
Message 2 of 5 (207 Views)

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
Posts: 12
Registered: ‎06-29-2012
Message 3 of 5 (205 Views)

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 !

Distinguished Contributor
ollikat
Posts: 144
Registered: ‎04-01-2011
Message 4 of 5 (201 Views)

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
Posts: 12
Registered: ‎06-29-2012
Message 5 of 5 (199 Views)

Re: Element ID

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

ok thankyou so much !  I will try again. 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Revit Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Revit helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Revit

Twitter

Facebook

Blogs

Youtube