# Transfer parameter values from Rooms to Asociated Doors

**URL:** <https://forum.dynamobim.com/t/transfer-parameter-values-from-rooms-to-asociated-doors/17266>\
**Category:** Uncategorized\
**Tags:** python\
**Created:** [December 10, 2017, 10:37am UTC](https://forum.dynamobim.com/t/transfer-parameter-values-from-rooms-to-asociated-doors/17266 "2017-12-10T10:37:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Spineboat](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@Spineboat](https://forum.dynamobim.com/u/Spineboat)\
**Post date:** [December 10, 2017, 10:37am UTC](https://forum.dynamobim.com/t/transfer-parameter-values-from-rooms-to-asociated-doors/17266/1 "2017-12-10T10:37:30Z")

</div>

Hi I am trying to modify/expand the functionality of Konrad Sobons python script - Door numbering from room number. - with no succes

My goal is to be able to also write:  
Firerating - Acoustics - Automation -etc. from the rooms to the doors. (we are using dRofus and have all these information assigned here to the rooms)

Is it possible at all to extend the python script to extract these parameters and write them to the doors?  
I have tried to write in as at test “room\_department” in the python script with the same spelling but all I get is an empty list and a python node turning yellow.

This is my first attempt with python - I was just trying to get lucky with so logic assumptions on how it looks like it should work, but it seem that I do something fundamental wrong

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

fam\_inst = IN[0]

elements =   
for i in IN[0]:  
elements.append(UnwrapElement(i))

def TryGetToRoom(room, phase):  
try:  
toRoom = room.get\_ToRoom(phase)  
except:  
toRoom = None  
pass  
return toRoom

def TryGetFromRoom(room, phase):  
try:  
fromRoom = room.get\_FromRoom(phase)  
except:  
fromRoom = None  
pass  
return fromRoom

room\_number, room\_department, room\_name, doors, room = , , , ,   
for i in elements:  
for phase in doc.Phases:  
if i.CreatedPhaseId == phase.Id:  
for phase2 in doc.Phases:  
if TryGetToRoom(i, phase2) != None:  
to\_room = TryGetToRoom(i, phase2)  
break  
else:  
to\_room = None  
for phase3 in doc.Phases:  
if TryGetFromRoom(i, phase3) != None:  
from\_room = TryGetFromRoom(i, phase3)  
break  
else:  
from\_room = None

if from\_room == None and to\_room == None:  
room\_number.append(“No to or from room”)  
room\_name.append(“No to or from room”)  
room\_department.append(“No to or from room”)  
doors.append(“No to or from room”)  
elif to\_room != None:  
Numbers = to\_room.GetParameters(“Number”)  
Names = to\_room.GetParameters(“Name”)  
Departments = to\_room.GetParameters(“Department”)  
for n in range(len(Numbers)):  
room\_number.append(Numbers[n].AsString())  
room\_name.append(Names[n].AsString())  
room\_department.append(Departments[n].AsString())  
doors.append(i)  
room.append(to\_room)

#Assign your output to the OUT variable  
OUT = room\_number, room\_name, room\_department, doors, room

 ![Dynamo](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/e/fe8222928827c8dbf43c98602f2984380d6b4299.PNG)

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [December 10, 2017, 4:19pm UTC](https://forum.dynamobim.com/t/transfer-parameter-values-from-rooms-to-asociated-doors/17266/2 "2017-12-10T16:19:43Z")

</div>

Looks like you may have some indentation errors, but I can’t see as we lost formatting. Can you repost with the formatting by selecting your code and hitting the preformatted text button (it’s the \</\> butting next to the quote) on the toolbar?

Also expand the error and post it so we can see that as well - really helps narrow things down.

Lastly, could you use regular nodes here? May be easier to wrap your head around as this isn’t easy for a ‘my first Python’ type of task.

---

<div class="post-metadata">

**Author:** ![Spineboat](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@Spineboat](https://forum.dynamobim.com/u/Spineboat)\
**Post date:** [December 13, 2017, 8:26pm UTC](https://forum.dynamobim.com/t/transfer-parameter-values-from-rooms-to-asociated-doors/17266/3 "2017-12-13T20:26:44Z")

</div>

Thanks Jacob for getting me on the right track

As you suggested I made the extension with regular nodes  
This is a test where I wrote areas from rooms to finish Doors just to check it worked

 ![Getparameters from room](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/8/086370badbbd9a7ab2c64e89097289c2956196bf.PNG)
