# Place Unplaced Rooms - New Room Method

**URL:** <https://forum.dynamobim.com/t/place-unplaced-rooms-new-room-method/35224>\
**Category:** Revit\
**Tags:** api, rooms\
**Created:** [April 25, 2019, 5:03pm UTC](https://forum.dynamobim.com/t/place-unplaced-rooms-new-room-method/35224 "2019-04-25T17:03:55Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![christopher.riddell](https://avatars.discourse-cdn.com/v4/letter/c/c89c15/32.png) [@christopher.riddell](https://forum.dynamobim.com/u/christopher.riddell)\
**Post date:** [April 25, 2019, 5:03pm UTC](https://forum.dynamobim.com/t/place-unplaced-rooms-new-room-method/35224/1 "2019-04-25T17:03:55Z")

</div>

Perhaps someone can help me here… I’m trying to place unplaced rooms using the NewRoom(room, plan circuit) method. I’m feeding in Rooms and circuits ; however, the warning message I’m getting its looking for either a phase or level. It appears it is looking at the other two NewRoom methods, but not the one I want to use. Any thoughts?  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/d/cd63826448400c1b2628c933243fb67acb405b91.png)

> import clr
> 
> clr.AddReference(‘RevitAPI’)  
> from Autodesk.Revit.DB import \*  
> from Autodesk.Revit.DB.Structure import \*
> 
> clr.AddReference(‘RevitAPIUI’)  
> from Autodesk.Revit.UI import \*
> 
> clr.AddReference(‘System’)  
> from System.Collections.Generic import List
> 
> clr.AddReference(‘RevitNodes’)  
> import Revit  
> clr.ImportExtensions(Revit.GeometryConversion)  
> clr.ImportExtensions(Revit.Elements)
> 
> clr.AddReference(‘RevitServices’)  
> import RevitServices  
> from RevitServices.Persistence import DocumentManager  
> from RevitServices.Transactions import TransactionManager
> 
> doc = DocumentManager.Instance.CurrentDBDocument  
> uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
> 
> #Preparing input from dynamo to revit  
> #Do some action in a Transaction  
> TransactionManager.Instance.EnsureInTransaction(doc)
> 
> UnplacedRooms=UnwrapElement(IN[0])  
> circuit = IN[1]  
> roomlist =
> 
> # Start Transaction
> 
> TransactionManager.Instance.EnsureInTransaction(doc)
> 
> for room in UnplacedRooms:  
> a=doc.Create.NewRoom(UnplacedRooms,circuit)  
> roomlist.append(a)
> 
> # End Transaction
> 
> TransactionManager.Instance.TransactionTaskDone()
> 
> OUT = roomlist

---

<div class="post-metadata">

**Author:** ![cgartland](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/cgartland/32/45378_2.png) [@cgartland](https://forum.dynamobim.com/u/cgartland)\
**Post date:** [April 25, 2019, 5:15pm UTC](https://forum.dynamobim.com/t/place-unplaced-rooms-new-room-method/35224/2 "2019-04-25T17:15:02Z")

</div>

Replace your `UnplacedRooms` variable with `room` in your list. The way you currently have it written, it is trying to use the entire list of rooms as the Room argument. One of the overloads for the NewRoom method is (Level, UV) so that’s why you’re seeing that particular error message.

```
for room in UnplacedRooms:
    a = doc.Create.NewRoom(room, circuit)
    roomlist.append(a)
```

---

<div class="post-metadata">

**Author:** ![christopher.riddell](https://avatars.discourse-cdn.com/v4/letter/c/c89c15/32.png) [@christopher.riddell](https://forum.dynamobim.com/u/christopher.riddell)\
**Post date:** [April 25, 2019, 5:20pm UTC](https://forum.dynamobim.com/t/place-unplaced-rooms-new-room-method/35224/3 "2019-04-25T17:20:24Z")

</div>

wow thanks … can’t believe I missed that. Been tinkering with this for too long I guess.

I still am getting the same error though…

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

For whatever reason its not recognizing I’m wanting to give it rooms and circuits…

---

<div class="post-metadata">

**Author:** ![Dennis\_Goff](https://avatars.discourse-cdn.com/v4/letter/d/51bf81/32.png) [@Dennis\_Goff](https://forum.dynamobim.com/u/Dennis_Goff)\
**Post date:** [May 3, 2019, 11:02pm UTC](https://forum.dynamobim.com/t/place-unplaced-rooms-new-room-method/35224/5 "2019-05-03T23:02:43Z")

</div>

I’m having that same problem. Can’t seem to get it to use the correct method. Have you had any luck since this post?

---

<div class="post-metadata">

**Author:** ![cgartland](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/cgartland/32/45378_2.png) [@cgartland](https://forum.dynamobim.com/u/cgartland)\
**Post date:** [May 3, 2019, 11:17pm UTC](https://forum.dynamobim.com/t/place-unplaced-rooms-new-room-method/35224/6 "2019-05-03T23:17:18Z")

</div>

Perhaps the circuit also has to be unwrapped? In its current form, `doc.Create.NewRoom(room, circuit)` would be providing a Revit-owned room and a Dynamo-owned circuit. I don’t have access to Revit right now to test but I think that may be the issue.

---

<div class="post-metadata">

**Author:** ![Dennis\_Goff](https://avatars.discourse-cdn.com/v4/letter/d/51bf81/32.png) [@Dennis\_Goff](https://forum.dynamobim.com/u/Dennis_Goff)\
**Post date:** [May 3, 2019, 11:41pm UTC](https://forum.dynamobim.com/t/place-unplaced-rooms-new-room-method/35224/7 "2019-05-03T23:41:36Z")

</div>

I managed to get it working by unwrapping the room in the loop:

```
for room in unPRooms:
    rm = UnwrapElement(room)
    newRoom = doc.Create.NewRoom(rm,planCirc)
    newRoom.LimitOffset = 5

```

In order for it to fully finish, I had to apply a “height” to the room with the Limit Offset parameter. I’m still not 100% sure what UnwrapElement really does but that got it working for me.

---

<div class="post-metadata">

**Author:** ![cgartland](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/cgartland/32/45378_2.png) [@cgartland](https://forum.dynamobim.com/u/cgartland)\
**Post date:** [May 3, 2019, 11:44pm UTC](https://forum.dynamobim.com/t/place-unplaced-rooms-new-room-method/35224/8 "2019-05-03T23:44:32Z")

</div>

UnwrapElement is a way of establishing an element as Revit-owned. If you are interacting with the Revit API, all of your data has to be either generic types (strings, ints, etc.) or Revit-owned types (Element, Parameter, etc.).

---

<div class="post-metadata">

**Author:** ![christopher.riddell](https://avatars.discourse-cdn.com/v4/letter/c/c89c15/32.png) [@christopher.riddell](https://forum.dynamobim.com/u/christopher.riddell)\
**Post date:** [May 4, 2019, 12:02pm UTC](https://forum.dynamobim.com/t/place-unplaced-rooms-new-room-method/35224/9 "2019-05-04T12:02:44Z")

</div>

Awesome… I had abandoned this for a bit. Thanks for the extra push.

---

<div class="post-metadata">

**Author:** ![christopher.riddell](https://avatars.discourse-cdn.com/v4/letter/c/c89c15/32.png) [@christopher.riddell](https://forum.dynamobim.com/u/christopher.riddell)\
**Post date:** [May 4, 2019, 12:32pm UTC](https://forum.dynamobim.com/t/place-unplaced-rooms-new-room-method/35224/10 "2019-05-04T12:32:31Z")

</div>

still getting the same error… I’ve tried unwrapping all elements outside and inside of the loop. Did you only do it within?

```
TransactionManager.Instance.EnsureInTransaction(doc)

unPRooms = UnwrapElement(IN[0])
planCirc= UnwrapElement(IN[1])
Height = UnwrapElement(IN[2])
roomlist = []

# Start Transaction
TransactionManager.Instance.EnsureInTransaction(doc)

for room in unPRooms:
	rm= UnwrapElement(room)
	pc = UnwrapElement(planCirc)
	newRoom = doc.Create.NewRoom(rm,pc)
	newRoom.LimitOffset = Height
	roomlist.append(newRoom)

# End Transaction
TransactionManager.Instance.TransactionTaskDone()

OUT = roomlist
```

---

<div class="post-metadata">

**Author:** ![Dennis\_Goff](https://avatars.discourse-cdn.com/v4/letter/d/51bf81/32.png) [@Dennis\_Goff](https://forum.dynamobim.com/u/Dennis_Goff)\
**Post date:** [May 4, 2019, 6:27pm UTC](https://forum.dynamobim.com/t/place-unplaced-rooms-new-room-method/35224/11 "2019-05-04T18:27:38Z")

</div>

Here’s my full code. In my case, I was moving all unplaced rooms into a single location, so that’s what the “target area” part is all about. I also had to give it a phase and a level in order to get all of the available plan circuits.

```
outL = []

lvl = UnwrapElement(IN[1])
phs = UnwrapElement(IN[2])
unPRooms = IN[0]
targetArea = IN[3]
### GET TARGET PLAN CIRCUIT
topo = doc.get_PlanTopology(lvl,phs)
circs = topo.Circuits
planCirc = None	
for circ in circs:
    outL.append(circ.Area)
    if round(circ.Area,5) == round(targetArea,5):
	    planCirc = circ

TransactionManager.Instance.EnsureInTransaction(doc)
for room in unPRooms:
    rm = UnwrapElement(room)
    newRoom = doc.Create.NewRoom(rm,planCirc)
    newRoom.LimitOffset = 5
TransactionManager.Instance.TransactionTaskDone()
```

---

<div class="post-metadata">

**Author:** ![christopher.riddell](https://avatars.discourse-cdn.com/v4/letter/c/c89c15/32.png) [@christopher.riddell](https://forum.dynamobim.com/u/christopher.riddell)\
**Post date:** [May 6, 2019, 11:09am UTC](https://forum.dynamobim.com/t/place-unplaced-rooms-new-room-method/35224/12 "2019-05-06T11:09:06Z")

</div>

great thanks
