Cant cast Element to Room

Cant cast Element to Room

Kevin.Bell
Advisor Advisor
374 Views
2 Replies
Message 1 of 3

Cant cast Element to Room

Kevin.Bell
Advisor
Advisor

Hi,

 

I'm trying to iterate a load of FamilyInstances from a linked model to find out their room locations which I will add to a parameter.

 

I'm getting the FamilyInstance location point and want to check it using Room.IsPointInRoom, I've collected a list of rooms from the model and linked models as elements.

 

I now need to cast the Elements to a Room to use the method IsPointInRoom and am trying:

 

Room thisroom = roomelement as Room

 

But when I try this I get the error 'Type or Namespace Room cannot be found'.

 

My code is using :

using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;

 

Am I missing something?

 

Thanks.

 

 

 

 

Accepted solutions (1)
375 Views
2 Replies
Replies (2)
Message 2 of 3

RPTHOMAS108
Mentor
Mentor
Accepted solution

Rooms are within the Autodesk.Revit.DB.Architecture Namespace

 

 

Message 3 of 3

Kevin.Bell
Advisor
Advisor

Bingo! 

 

Thanks for your help!!