# Room: Name access from dynamo

**URL:** <https://forum.dynamobim.com/t/room-name-access-from-dynamo/74211>\
**Category:** Revit\
**Tags:** dynamo\
**Created:** [March 10, 2022, 2:47pm UTC](https://forum.dynamobim.com/t/room-name-access-from-dynamo/74211 "2022-03-10T14:47:24Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rick](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@Rick](https://forum.dynamobim.com/u/Rick)\
**Post date:** [March 10, 2022, 2:47pm UTC](https://forum.dynamobim.com/t/room-name-access-from-dynamo/74211/1 "2022-03-10T14:47:24Z")

</div>

Hello everyone, how can I get access to te “Room: Name” parameter in dynamo. The parameter I am talking is the one of the image

Thanks a lot!

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/8/f88f201c06ff1bd72203c88a7006afff64696261.png)

---

<div class="post-metadata">

**Author:** ![Elie.Trad](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/elie.trad/32/110373_2.png) [@Elie.Trad](https://forum.dynamobim.com/u/Elie.Trad)\
**Post date:** [March 10, 2022, 3:00pm UTC](https://forum.dynamobim.com/t/room-name-access-from-dynamo/74211/2 "2022-03-10T15:00:11Z")

</div>

@Rick check this:

> [@How to get element room name?](https://forum.dynamobim.com/t/how-to-get-element-room-name/26752/2):
>
> Hi, You can use Elements in Room from archilab and FamilyInstances.Room from Rhythm.

---

<div class="post-metadata">

**Author:** ![Rick](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@Rick](https://forum.dynamobim.com/u/Rick)\
**Post date:** [March 10, 2022, 4:27pm UTC](https://forum.dynamobim.com/t/room-name-access-from-dynamo/74211/3 "2022-03-10T16:27:43Z")

</div>

Didn’t work, for some reason I can’t get the room from plumbing fixtures and others familys

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/0/f005e49bb39566077f0abeab61534527af63ebdd.png)

---

<div class="post-metadata">

**Author:** ![john\_pierson](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/john_pierson/32/191977_2.png) [@john\_pierson](https://forum.dynamobim.com/u/john_pierson)\
**Post date:** [March 10, 2022, 4:38pm UTC](https://forum.dynamobim.com/t/room-name-access-from-dynamo/74211/4 "2022-03-10T16:38:44Z")

</div>

Do you have phasing in your project?

Are the rooms and fixtures in the same phase?

Is there a phase after whatever phase they are on?

---

<div class="post-metadata">

**Author:** ![Rick](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@Rick](https://forum.dynamobim.com/u/Rick)\
**Post date:** [March 10, 2022, 4:47pm UTC](https://forum.dynamobim.com/t/room-name-access-from-dynamo/74211/5 "2022-03-10T16:47:47Z")

</div>

OHH, yes, i have phases!  
They are not in the same phase

But why Revit can get the Room Name, and dynamo can’t?

---

<div class="post-metadata">

**Author:** ![\_Vijay](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/_vijay/32/91307_2.png) [@\_Vijay](https://forum.dynamobim.com/u/_Vijay)\
**Post date:** [March 10, 2022, 4:53pm UTC](https://forum.dynamobim.com/t/room-name-access-from-dynamo/74211/6 "2022-03-10T16:53:19Z")

</div>

Dynamo definitely can.

---

<div class="post-metadata">

**Author:** ![\_Vijay](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/_vijay/32/91307_2.png) [@\_Vijay](https://forum.dynamobim.com/u/_Vijay)\
**Post date:** [March 10, 2022, 4:55pm UTC](https://forum.dynamobim.com/t/room-name-access-from-dynamo/74211/7 "2022-03-10T16:55:13Z")

</div>

if you share one sample file then I can try.

---

<div class="post-metadata">

**Author:** ![john\_pierson](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/john_pierson/32/191977_2.png) [@john\_pierson](https://forum.dynamobim.com/u/john_pierson)\
**Post date:** [March 10, 2022, 5:03pm UTC](https://forum.dynamobim.com/t/room-name-access-from-dynamo/74211/8 "2022-03-10T17:03:26Z")

</div>

> [@Rick](#):
>
> But why Revit can get the Room Name, and dynamo can’t?

Yes. Dynamo can do it. Rhythm for example is hard coded to get the room in the same phase of the family instance. Code [here](https://github.com/johnpierson/RhythmForDynamo/blob/243d539bfac505941bd95951a58a9f960fd9a6aa/src/Rhythm/Revit/Elements/FamilyInstance.cs#L38-L66). I believe that stands true for the OOTB node as well.

For your workflow, you will need a node that allows you to input a phase to “search” in. Let me see if I can add that to Rhythm.

But if you are comfortable copying and pasting a python script. This one should do it:

```auto
# import common language runtime 
import clr

# Import RevitAPI
clr.AddReference("RevitAPI")
# import all classes from Revit DB
from Autodesk.Revit.DB import *

# import Revit dynamo libraries
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

# custom definition for getting room that works with single items or lists
def GetRoomInPhase(item,phase):
	return item.Room[phase]

# the family instances
items = UnwrapElement(IN[0])
phase = UnwrapElement(IN[1])

# return the results
if isinstance(IN[0], list): OUT = [GetRoomInPhase(x,phase) for x in items]
else: OUT = GetRoomInPhase(items,phase)

```

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/5/a56e0fd26cde816bdf0790ade30a0b2b2f74dde6.jpeg)

SampleDyn:  
[FamilyInstanceGetRoomInPhase.dyn](https://forum.dynamobim.com/uploads/short-url/pfiXOuzph8pbBZJpMipRlSv3FrC.dyn) (11.1 KB)

---

<div class="post-metadata">

**Author:** ![Rick](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@Rick](https://forum.dynamobim.com/u/Rick)\
**Post date:** [March 10, 2022, 5:18pm UTC](https://forum.dynamobim.com/t/room-name-access-from-dynamo/74211/9 "2022-03-10T17:18:00Z")

</div>

Yes, of course  
Here: look at the two plumbing fixture, image it is a renovation  
[Project1.rvt](https://forum.dynamobim.com/uploads/short-url/uTv99hPUJfKoRkAKegbEuihZ1Hi.rvt) (2.1 MB)  
[Home.dyn](https://forum.dynamobim.com/uploads/short-url/pSkShv5CWIqhiPWhQPYxm1eYho3.dyn) (5.3 KB)

Look the schedule, I can get the room name

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/d/fde96a38ab43f7f3fcddd8822dfe0572e894aa16.png)  
But in dynamo not  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/0/002fcddb8ef12428716f26ead9710ce336b40a6a.png)

---

<div class="post-metadata">

**Author:** ![Rick](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@Rick](https://forum.dynamobim.com/u/Rick)\
**Post date:** [March 10, 2022, 5:25pm UTC](https://forum.dynamobim.com/t/room-name-access-from-dynamo/74211/10 "2022-03-10T17:25:21Z")

</div>

Ok, now i get it!  
I have elements demolished in “phase 2”, but all my rooms are in the phase 2, I’d like to get my elements in phase 1, and know in which room from phase 2 are they.  
Revit can do this in schedules, but i can’t figure out how to do this in dynamo

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/c/cca30e5e77598cb0beed9ce746082d44cca4518d.png)

---

<div class="post-metadata">

**Author:** ![john\_pierson](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/john_pierson/32/191977_2.png) [@john\_pierson](https://forum.dynamobim.com/u/john_pierson)\
**Post date:** [March 10, 2022, 7:34pm UTC](https://forum.dynamobim.com/t/room-name-access-from-dynamo/74211/11 "2022-03-10T19:34:44Z")

</div>

hmm, there are other ways so let me take a look on my end.

---

<div class="post-metadata">

**Author:** ![john\_pierson](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/john_pierson/32/191977_2.png) [@john\_pierson](https://forum.dynamobim.com/u/john_pierson)\
**Post date:** [March 11, 2022, 3:14pm UTC](https://forum.dynamobim.com/t/room-name-access-from-dynamo/74211/12 "2022-03-11T15:14:06Z")

</div>

Here we go. This one works off of point locations. This is nice because you can move the points around in Dynamo if you know that your element location is a bit off.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/5/656aa56296fbd967f0f654b3cefd34b684fcb1e4.jpeg)

[FamilyInstanceGetRoomInPhaseAtPoint.dyn](https://forum.dynamobim.com/uploads/short-url/gOYWOiM4OFXuCC5OhyKJp4HArmK.dyn) (12.8 KB)

and the python:

```auto
# import common language runtime 
import clr

# Import RevitAPI
clr.AddReference("RevitAPI")
# import all classes from Revit DB
from Autodesk.Revit.DB import *

# import Revit dynamo libraries
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument

# custom definition for getting room that works with single items or lists
def GetRoomInPhaseAtPoint(point,phase):
	try:
	    return doc.GetRoomAtPoint(point.ToRevitType(True),phase)
	except:
		return None

# the family instances
locations = UnwrapElement(IN[0])
phase = UnwrapElement(IN[1])

# return the results
if isinstance(IN[0], list): OUT = [GetRoomInPhaseAtPoint(x,phase) for x in locations]
else: OUT = GetRoomInPhase(locations,phase)

```

---

<div class="post-metadata">

**Author:** ![Rick](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@Rick](https://forum.dynamobim.com/u/Rick)\
**Post date:** [March 14, 2022, 4:18pm UTC](https://forum.dynamobim.com/t/room-name-access-from-dynamo/74211/13 "2022-03-14T16:18:51Z")

</div>

Thanks!
