Hierarchy of Revit Elements

Hierarchy of Revit Elements

Anonymous
Not applicable
6,140 Views
3 Replies
Message 1 of 4

Hierarchy of Revit Elements

Anonymous
Not applicable

Do elements in Revit follows a particular hierarchy? That is if I want to programmaticly create a Room in Revit, Is it that we have to first a create a Floor then Level and then finally Room. May I get a sample code for creating Floor, Level and Room in Revit.

0 Likes
6,141 Views
3 Replies
Replies (3)
Message 2 of 4

jeremytammik
Autodesk
Autodesk

Dear Alok Anand,

 

Thank you for your query.

 

Yes and no.

 

There are several important ways to slice and dice Revit database elements into various groupings.

 

The most important thing, though, before you even start to think about programmatically creating anything whatsoever, is to achieve a certain level of understanding of Revit and the best practices and optimal workflows from a manual user point of view.

 

That will vastly simplify any of your programming endeavours.

 

Revit equips the BIM with a huge amount of very sophisticated automation.

 

Unless you understand in some depth what is provided by Revit itself, I can almost guarantee that any of your programming efforts will inevitably lead you into conflict with the existing best practices, and make your task much harder to achieve and probably also counterproductive and inefficient.

 

Here are some more extensive excursions into the topic of 'Revit and its API is different':

 

http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.41

 

The most important hierarchy of Revit elements is the separation into family definition, family type and family instance.

 

Some families, such as walls and floors, are built-in system families. They also have types, and the instances are the walls and floors.

 

Play around with those concepts from an end user point of view to understand better.

 

To address your question more directly: I believe you would create all the levels first of all.

 

That is easy. Here is some sample code that creates a new level, floor and slab:

 

http://thebuildingcoder.typepad.com/blog/2014/03/creating-a-sloped-floor.html

 

It is included in the external command CmdCreateSlopedSlab in The Building Coder samples:

 

https://github.com/jeremytammik/the_building_coder_samples

 

That discussion also points to the ADN Xtra labs, which includes and external command Lab2_0_CreateLittleHouse implemented in both  C# and VB that creates a model of an entire little house including walls, floor, roof, door, windows, room and various tags:

 

https://github.com/jeremytammik/AdnRevitApiLabsXtra

 

https://github.com/jeremytammik/AdnRevitApiLabsXtra/blob/master/XtraCs/Labs2.cs

 

I hope this helps.

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 4

Anonymous
Not applicable

Trusting that someone will correct this if I write the wrong thing, but I understand a Revit "room" to be an object that has both physical (model) aspects in addition to abstract aspects, and a room can lack the physical aspect. The physical aspects are what your question refers to, that being a floor and walls. These are the model items that create the room's boundary elements. The abstract room aspects are things like its name, purpose, occupant load, surface finishes and so on. In our minds a room cannot exist without the physical elements to be the room boundary limits. Rooms in Revit are special. Revit allows rooms to exist without the physical aspects. The purpose for Revit allowing abstract only rooms to exist is to allow Architects to maintain the project's "Architectural program" (room needs) information present in the Revit project ready to have the room bounding elements assigned. So to answer your question, I bet you don't have to have a floor and walls to have a room. 

 

0 Likes
Message 4 of 4

jeremytammik
Autodesk
Autodesk

Thank you for clarifying. Yes, you can definitely define 'unplaced' rooms which are not associated with any BIM geometry whatsoever. They can be used for space planning purposes, e.g.



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes