Managing data in Autodesk Revit is often done with Schedules or by manual modification of parameter values. Some of those tasks can take some time before you get finished. In this example we will have a deeper look at Dynamo for Revit. Generative design is not only about 'creations' or 'parametric modelling', it's also "generative" if you optimize your existing design by editing your data upfront.
Imagine the next situation in Revit: We have a project, consisting of multiple phases. Within each phase some Walls, Doors and Rooms are defined. Each Room has a project parameter "Wheelchair Access" assigned to. This Yes/No parameter allows the designer to indicate if the Room has specific access requirements. The designer would like his Doors to adapt to this requirement, and… ASAP.
In the video, posted at the bottom of this tread, you'll see how the design can be verified and adapted with Dynamo 0.7.4. First you need to extract the 'ToRoom' information of the Doors. Therefore a custom node with some Python script in it can be used. This script checks all selected doors and/or windows, and extracts the ToRoom information for all designed phases in the Revit model. Analogue you can edit this code to get the FromRoom information. You can copy the code below straight into your Python node.
#This script detects the "To Room" parameters for all doors or windows, for all model phases.
#Elements with no "ToRoom" indication will be set as ToRoom = None
# Import RevitAPI
from Autodesk.Revit.DB import *
# Import DocumentManager and TransactionManager
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
# Import ToDSType(bool) extension method
# Start Transaction
doc = DocumentManager.Instance.CurrentDBDocument
#Declare list variables
ToRoomName = 
ToRoom = 
elements = 
for i in IN:
#List the "To Room" for all phases
for i in elements:
for phase in doc.Phases:
if i.CreatedPhaseId == phase.Id:
to_room = i.ToRoom[phase]
# End Transaction
#Assign your output to the OUT variable
OUT = ToRoomName, ToRoom
With that information you can filter your Door/Window list and perform the appropriate action, which is in this case a change of family type.
You can try it out yourself and download the datasets on this link.
Download the Dynamo Package "Get To-From Room" using the Package Manager in Dynamo.