Removing not placed rooms with Dynamo

As it is probably well known for everybody using Revit that rooms removed from model are still kept within the file as “not placed”. In order to delete them completely we have to create a schedule that would filter them for us. It is not a very tedious process, however still can be simplified by using Dynamo 🙂

This is what such a schedule might look like. We can see that for not placed rooms the values of area and level parameters are not set. This is something that can be used for their identification. But we should also notice that not enclosed rooms have no area specified as well. We do not want to delete those. Therefore we are going to use room’s location.

Our Dynamo definition might look like this:

The algorithm is rather simple:

-we collect all the model elements that are rooms
-for each room we read it’s location parameter and check whether it is null (not specified)
-then we filter our room list based on the result of the above
-finally we can remove filtered rooms

It should be said that out of the box Dynamo does not provide a node that would delete our rooms. Fortunately we can use a simple python script for that:

import clr

clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *

clr.AddReference("RevitServices")
import RevitServices

from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument

elements = UnwrapElement(IN[0])

TransactionManager.Instance.EnsureInTransaction(doc)

for e in elements:

        id=e.Id
        doc.Delete(id)        
        
TransactionManager.Instance.TransactionTaskDone()

#Assign your output to the OUT variable.
OUT = 0
Posts created 34

2 thoughts on “Removing not placed rooms with Dynamo

  1. Bardzo potrzebowalem skrypt na usuniecie pokoi – DZIEKI MACIEJ! – dziala bez zarzutu / works flawlessly! – great script.

Leave a Reply

Your email address will not be published.

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top