How to calculate Column area of Room in Revit API

How to calculate Column area of Room in Revit API

Pravin_Lande
Enthusiast Enthusiast
1,652 Views
5 Replies
Message 1 of 6

How to calculate Column area of Room in Revit API

Pravin_Lande
Enthusiast
Enthusiast

Hi,

 

We want to get total column area from selected Room in Revit API programmatically.

 

kindly suggest how can we get the column area from Room.

 

Thanks and Regards,

Pravin Lande

0 Likes
Accepted solutions (1)
1,653 Views
5 Replies
Replies (5)
Message 2 of 6

Moustafa_K
Collaborator
Collaborator
Accepted solution

it is a bit tricky, as you have 2 probabilities,

  1. Column is inside the room,
  2. or column is on the edge of the room (meaning columns is a part of room outer boundary) 

just A quick though, is to:

  1. get the boundary segments of the room
    1. you will get 1 or more list of segments
    2. the 1st list the the outer Room boundary
    3. the others are cutout from the room volume.
  2. loop through the list of boundaries.
    1. looping through a boundary segments you will find a property called Element Id.
    2. this EId is the actual element that forms the outer lines of a room (could be a wall, structure column, room separator line...etc)
  3. now get this forming element from the document via its element id you picked from step 2.2, and check if it is a column or not.
  4. once you get the column, you can get the area of the column
    1. from its geometry (col.get_Geometry(op))
      1. getting the bottom face (Z=-1) and calculate its area
    2. or the normal way Length* width (assuming all your columns are:
      1. correctly assigned length and width parameters in its family document
      2. your column is in a rectangular/Square shape.

I hope this guides you to achieve what you are looking for.

Moustafa Khalil
Cropped-Sharp-Bim-500x125-Autodesk-1
0 Likes
Message 3 of 6

jeremytammik
Autodesk
Autodesk

Dear Pravin,

 

Thank you for your query and many thanks to Moustafa for his more detailed answer; I only read it after posting mine 🙂

 

As often, there are an infinite number of ways to address this.

 

The simplest approach would probably be as follows, for each room:

 

 

I hope this helps.

 

Best regards,

 

Jeremy

 



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

0 Likes
Message 4 of 6

Moustafa_K
Collaborator
Collaborator

@jeremytammik I think there should be one more addition note to your solution, is the Columns should not be marked (Room Bounding), otherwise the columns area will be already deducted from the reported room area.

Moustafa Khalil
Cropped-Sharp-Bim-500x125-Autodesk-1
0 Likes
Message 5 of 6

jeremytammik
Autodesk
Autodesk

Absolutely! Thank you for pointing that out!

 

And, more so, thank you very much for all the answers you have been providing lately!

  

Another approach that I would probably also try out is geometry based:

 

Create a 2D polygon in the XY plane from the room boundary curves. For each column, create a polygon for its 2D footprint. Subtract all the latter from the former. This can be achieved by using an external 2D Boolean library, for instance Clipper, discussed repeatedly here in the forum and by The Building Coder. Using that approach makes you much more independent of the quality of the BIM and the settings applied to individual elements, such as the Room Bounding property you mention.

 



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

0 Likes
Message 6 of 6

Moustafa_K
Collaborator
Collaborator

Thanks Jeremy, it is my pleasure to support Revit API Community (I call it Reviteers). 

Clipper is indeed amazing library. Thanks for sharing that. 

Moustafa Khalil
Cropped-Sharp-Bim-500x125-Autodesk-1
0 Likes