# Change Room Phase

**URL:** <https://forum.dynamobim.com/t/change-room-phase/7352>\
**Category:** Revit\
**Created:** [November 8, 2016, 2:41pm UTC](https://forum.dynamobim.com/t/change-room-phase/7352 "2016-11-08T14:41:01Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![Ahmad\_Saad](https://avatars.discourse-cdn.com/v4/letter/a/ac8455/32.png) [@Ahmad\_Saad](https://forum.dynamobim.com/u/Ahmad_Saad)\
**Post date:** [November 10, 2016, 11:22am UTC](https://forum.dynamobim.com/t/change-room-phase/7352/9 "2016-11-10T11:22:40Z")

</div>

@Mostafa_El_Ayoubi me either I didn’t notice that 🙂  
@Andreas_Dieckmann I already tried that yesteday, and I thought about it as a second choice; if I couldn’t achieve creating the rooms directly with the phase option.

However; I found a node which creates a non-placed room by name, number, and phase (ClockWork package) but unfortunatly it doesn’t work on Dynamo 1.2.  
So I tried to update it, here is the daiagram.

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/7/1742597a554e58f4a932832ad2ed3d2183b1c20f.JPG)

And this is the Python script which creates the room by **_name, number, and phase_** :

> 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  
> doccreation = doc.Create  
> names = IN[0]  
> numbers = IN[1]  
> phase = UnwrapElement(IN[2])  
> counter = 0  
> elementlist = list()

> TransactionManager.Instance.EnsureInTransaction(doc)  
> for name in names:  
> newroom = doccreation.NewRoom(phase)  
> newroom.Name = name  
> newroom.Number = numbers[counter]  
> elementlist.append(newroom)  
> counter += 1  
> TransactionManager.Instance.TransactionTaskDone()

> OUT = elementlist

Also I found a node by @Julien_BENOIT which creates room by **_level and point_**

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

here is python script:

> #Developers nodes in dynamo 0.7  
> #proposed by Julien Benoit @jbenoit44  
> #[http://aecuandme.wordpress.com/](http://aecuandme.wordpress.com/)  
> import clr  
> clr.AddReference(‘ProtoGeometry’)  
> from Autodesk.DesignScript.Geometry import \*
> 
> # Import ToDSType(bool) extension method
> 
> clr.AddReference(“RevitNodes”)  
> import Revit  
> clr.ImportExtensions(Revit.Elements)
> 
> # Import geometry conversion extension methods
> 
> clr.ImportExtensions(Revit.GeometryConversion)
> 
> # Import DocumentManager and TransactionManager
> 
> clr.AddReference(“RevitServices”)  
> import RevitServices  
> from RevitServices.Persistence import DocumentManager  
> from RevitServices.Transactions import TransactionManager  
> from System.Collections.Generic import \*
> 
> # Import RevitAPI
> 
> clr.AddReference(“RevitAPI”)  
> import Autodesk  
> from Autodesk.Revit.DB import \*

> doc = DocumentManager.Instance.CurrentDBDocument  
> uiapp = DocumentManager.Instance.CurrentUIApplication  
> app = uiapp.Application  
> uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

> uvs =  
> for i in IN[0]:  
> uvs.append(UnwrapElement(i).ToXyz())  
> level=UnwrapElement(IN[1])  
> roomlist=

> # Start Transaction
> 
> TransactionManager.Instance.EnsureInTransaction(doc)

> for item in uvs:  
> uv=UV(item.X,item.Y)  
> a=doc.Create.NewRoom(level,uv)  
> roomlist.append(a)

> # End Transaction
> 
> TransactionManager.Instance.TransactionTaskDone()

> OUT = roomlist

So I am thinking of “merging” the two scripts together; to have one single script which creates a room by: **name, number, level, point, and phase**  
But my "scripting’ knowledge is almost zero 🙂  
So I apperciate if you could help me out with this guys.  
Regards

---

_[View the full topic](https://forum.dynamobim.com/t/change-room-phase/7352)._
