How to Identify unallocated volume towards rooms and spaces

How to Identify unallocated volume towards rooms and spaces

TomB.ADV
Advocate Advocate
992 Views
4 Replies
Message 1 of 5

How to Identify unallocated volume towards rooms and spaces

TomB.ADV
Advocate
Advocate

Hi, I am looking for a way to "scan" a model in order to retrieve the amount of volume (inclosed by walls)
which was not classified as room nor as space.

 

I assume this may be a multi-step solution where I need to somehow get and store in memory each
"volume instance"  in a List<T>  which I will itterate over to check if the volume has a room or a space in it
and subtract the room/space volume from the volume instance.

The problem is that I can't figure out how to get the "volume instances" I mentioned in the first place....
if there is a better idea/approach to solve this I will gladly try it as well, thanks!

 

 

 

993 Views
4 Replies
Replies (4)
Message 2 of 5

jeremy_tammik
Alumni
Alumni

Rooms and spaces have a ClosedShell property:

  

https://www.revitapidocs.com/2023/1a510aef-63f6-4d32-c0ff-a8071f5e23b8.htm

  

That would be one way to get the enclosed spaces that have been properly defined.

  

How to determine the entire enclosed building volume is another topic.

  

Here are some suggestions to determine Gross volume of a building:

  

https://www.revitcity.com/forums.php?action=viewthread&thread_id=11551

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
Message 3 of 5

TomB.ADV
Advocate
Advocate

Thanks @jeremy_tammik 

I did notice that property while reviewing the API docs. The real problem is to get the amount of enclosed partitions in the building and each partition volume.

I was hoping there is some reliable method to do this since the suggestions in the RevitCity forum are extremely outdated (2008).

Is there a way to programmatically identify and quantify enclosed spaces and get them as an Element or as a BoundingBox or an Outline or any other Revit API Class that will allow me to accurately do the task I described without using funky math which probably won't work in a non-typical project environment?

Message 4 of 5

TomB.ADV
Advocate
Advocate

@jeremy_tammik  after some more research I came accross the below thread:

https://forums.autodesk.com/t5/revit-api-forum/finding-a-room-by-wall/m-p/10190251#M54650

 

 

def get_rooms(wall):
    document = wall.Document
    wall_bb = wall.get_BoundingBox(None)
    outline = Outline(wall_bb.Min, wall_bb.Max)
    bbfilter = BoundingBoxIntersectsFilter(outline)
    rooms = FilteredElementCollector(document).OfCategory(BuiltInCategory.OST_Rooms).\
        WherePasses(bbfilter).ToElements()
    return rooms

 

 

The above code by @SergeyShvydko suggests that there is an option to get all the rooms which are associated with a specific wall. This gave me an idea to create a Dictionary<Room, List<Wall>> object to use for my calculations.

First, I will use LINQ to get all the rooms located on the desired floor. Then, I will get a .Distinct() list of walls associated with all the rooms. Afterward, I will calculate the area of all the walls associated with the rooms.

At this point, I will have the Floor Area, All Rooms Area, All Walls Area. Rooms Area + Walls Area should be
approximately equal to the Floor Area. If there is more than x% difference, there is probably a room missing
on that level which wasn't placed.

 

Any thoughts/suggestions to make this work better or to be more reliable method in general ?

0 Likes
Message 5 of 5

jeremy_tammik
Alumni
Alumni

Sounds like an effective and robust approach to me. Brilliant! Looking forward to hearing how it works out in real life, and seeing the final implementation. Good luck and have fun implementing and testing!

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes