It has been a while since I got the time to open the “admin module” of my WordPress blog. Starting a new career asks a lot of energy and time to get up and running again. Managing your own blog doesn’t fit within that agenda. But hey, here we are again !
As a structural engineer I have an analytic mind. Often I catch myself looking at buildings from the data perspective and not the aesthetic point of view. Not that I don’t like special and innovative architecture, but let’s allow some self-criticism and admit that I’m not into organic modelling…yet…
During my first weeks at Autodesk I got the opportunity to have a deeper look at Dynamo for Revit. And yes, I love it, it gets me thrilled, …, it’s addictive! My analytic brains told me they need help in managing data within that Revit project. “Hmm, can we do this with Dynamo? Isn’t this only for generating nice architecture?”, I hear one say. No ! 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.
Let’s have a deeper look at my first Dynamo project I want to share with you. 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. Now, the designer would like his Doors to adapt to this requirement. With ‘plain’ Revit he would have to do this manually and eventually use schedules to check the design, for multiple phases.
In the video, posted at the bottom of this tread, I’ll show you how the design can be verified and adapted with Dynamo 0.7.4. First I needed to extract the ‘ToRoom’ information of the Doors. Therefore I used a custom node with some Python script in it. 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.
#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 clr # Import RevitAPI clr.AddReference("RevitAPI") import Autodesk from Autodesk.Revit.DB import * # Import DocumentManager and TransactionManager clr.AddReference("RevitServices") import RevitServices from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager # Import ToDSType(bool) extension method clr.AddReference("RevitNodes") import Revit clr.ImportExtensions(Revit.Elements) # Start Transaction doc = DocumentManager.Instance.CurrentDBDocument TransactionManager.Instance.EnsureInTransaction(doc) #Declare list variables ToRoomName =  ToRoom =  elements =  #unwrap inputs for i in IN: elements.append(UnwrapElement(i)) #List the "To Room" for all phases for i in elements: for phase in doc.Phases: if i.CreatedPhaseId == phase.Id: try: to_room = i.ToRoom[phase] ToRoomName.append(to_room.get_Parameter("Name").AsString()) ToRoom.append(to_room) except: ToRoomName.append(None) ToRoom.append(None) continue # End Transaction TransactionManager.Instance.TransactionTaskDone() #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.
Download the Dynamo Package “Get To-From Room” using the Package Manager in Dynamo.
Download this dataset for access to the full script.