# Issue with Unwrapping room element from LunchBox

**URL:** <https://forum.dynamobim.com/t/issue-with-unwrapping-room-element-from-lunchbox/53204>\
**Category:** Developers\
**Tags:** revit, python, dynamo\
**Created:** [July 21, 2020, 6:57pm UTC](https://forum.dynamobim.com/t/issue-with-unwrapping-room-element-from-lunchbox/53204 "2020-07-21T18:57:22Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![yafim.simanovsky](https://avatars.discourse-cdn.com/v4/letter/y/f17d59/32.png) [@yafim.simanovsky](https://forum.dynamobim.com/u/yafim.simanovsky)\
**Post date:** [July 21, 2020, 6:57pm UTC](https://forum.dynamobim.com/t/issue-with-unwrapping-room-element-from-lunchbox/53204/1 "2020-07-21T18:57:22Z")

</div>

Hi,  
I’m using **Lunchbox Room Element Collector** in a **Dynamo** graph, which I then want to pass onto a **ZeroTouch** Node that accepts a **RevitAPI** `Room Element`.

I’m trying to `Unwrap` the rooms, which I understand is the way to go here to keep things consistant, but the following attached image doesn’t seem to success in converting from **Dynamo** to **RevitAPI**.

 ![Capture](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/e/9e5f8e09ec55948e0b583d1ec336d2efea16d80b.jpeg)

What am I doing wrong here…? Am I missing a reference perhaps?

Thanks

---

<div class="post-metadata">

**Author:** ![SeanP](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/seanp/32/42560_2.png) [@SeanP](https://forum.dynamobim.com/u/SeanP)\
**Post date:** [July 21, 2020, 11:27pm UTC](https://forum.dynamobim.com/t/issue-with-unwrapping-room-element-from-lunchbox/53204/2 "2020-07-21T23:27:26Z")

</div>

Unwrapping an element converts from Dynamo element TO Revit Elements which is what it looks like from the output. Can you elaborate on what you are trying to do or what isn’t working for you?

---

<div class="post-metadata">

**Author:** ![yafim.simanovsky](https://avatars.discourse-cdn.com/v4/letter/y/f17d59/32.png) [@yafim.simanovsky](https://forum.dynamobim.com/u/yafim.simanovsky)\
**Post date:** [July 22, 2020, 3:25pm UTC](https://forum.dynamobim.com/t/issue-with-unwrapping-room-element-from-lunchbox/53204/3 "2020-07-22T15:25:24Z")

</div>

Yes. Thanks for the reply.  
I’m using the `Lunchbox` component to extract model `Rooms`. So far so good. The output of the component is the `Revit.Elements.Room` which I understand is in the **DynamoAPI** , not the **RevitAPI**.

I’m trying to convert the `Revit.Elements.Room` to `Revit.DB.Room` using the `UnwrapElement` method.  
But the output of the `Object.Type` shows that the method didn’t succeed in converting the type.

Any ideas?  
Thanks

---

<div class="post-metadata">

**Author:** ![SeanP](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/seanp/32/42560_2.png) [@SeanP](https://forum.dynamobim.com/u/SeanP)\
**Post date:** [July 23, 2020, 8:08pm UTC](https://forum.dynamobim.com/t/issue-with-unwrapping-room-element-from-lunchbox/53204/4 "2020-07-23T20:08:09Z")

</div>

What are you wanting to do with the Room, because the Revit.Elements.Room is the object that gives you full access to the Room and all of its parameters?

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [July 23, 2020, 8:56pm UTC](https://forum.dynamobim.com/t/issue-with-unwrapping-room-element-from-lunchbox/53204/5 "2020-07-23T20:56:55Z")

</div>

There are a few things going on here that I think are confusing, so let’s work through them.

The wrapper is just a way for the DynamoAPI to interact with Revit elements. Object.Type still returns the RevitAPI object type, even though the object is “wrapped”. You are correct in your understanding of unwrapping elements in python, however, python _also_ automatically wraps them for you when it returns any RevitAPI object. Most nodes take the “wrapped” (Dynamo) object as the input because that’s just the “standard” format for Dynamo. I would be curious to see the ZT node you’re using that requires the unwrapped element. That may also give us some additional information on what you’re trying to accomplish that could lead to an alternative solution.

---

<div class="post-metadata">

**Author:** ![SeanP](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/seanp/32/42560_2.png) [@SeanP](https://forum.dynamobim.com/u/SeanP)\
**Post date:** [July 23, 2020, 10:49pm UTC](https://forum.dynamobim.com/t/issue-with-unwrapping-room-element-from-lunchbox/53204/6 "2020-07-23T22:49:17Z")

</div>

I missed the ZTN reference initially. You actually need to get the Element.InternalElement in your ZTN. Check this reference for how to translate incoming elements in the ZTN environment.

[https://alvpickmans.github.io/DynamoDevelopment-London-Hackathon-2019/03-ZeroTouch/04-RevitNodeDevelopment.html](https://alvpickmans.github.io/DynamoDevelopment-London-Hackathon-2019/03-ZeroTouch/04-RevitNodeDevelopment.html)

---

<div class="post-metadata">

**Author:** ![yafim.simanovsky](https://avatars.discourse-cdn.com/v4/letter/y/f17d59/32.png) [@yafim.simanovsky](https://forum.dynamobim.com/u/yafim.simanovsky)\
**Post date:** [July 25, 2020, 7:02am UTC](https://forum.dynamobim.com/t/issue-with-unwrapping-room-element-from-lunchbox/53204/7 "2020-07-25T07:02:07Z")

</div>

Hi Guys,  
Thanks for the replies.

@SeanP If I try the method of `e.InternalElement` that is suggested in that article, I run into a problem that the `Room` elements I am dealing with are part of `Autodesk.Revit.DB.Architecture` and not `Autodesk.Revit.DB`, and the message I get is an error that it can’t convert from one to the other. I wonder if `Rooms` are somehow unique in their definition. If it was a `Wall` it would work as the article suggests…

@Nick_Boyts What I have is a ZT node written in Visual Studio. The inputs and manipulations I am performing on the elements are in the **RevitAPI** , such as getting room locations and extracting various `Parameters` for some boundary inclusion tests.  
I want to keep things consistent and not mix **Dynamo** and **Revit** elements inside the same ZT node. I need specific parameters of `Rooms` that exist in the **RevitAPI** but not in the **DynamoAPI**.  
So in order to find some `Parameters` of the `Rooms` I need to use a **RevitAPI** `Room` Element in my ZT node.  
In **Dynamo** I’m extracting the Dynamo `Room` from the **Lunchbox** node, and I then want to pass it as input to my ZT node which has the following definition:

```
public static string GetData(Document document, List<Room> inputRooms, List<string> roomNames, List<Polygon> Polygons)
        { ... }

```

So I’ve tried converting the **Dynamo** Rooms in my graph to **Revit** Elements _ **before** _ inputting them to my ZT node using **Python**. If I can do this then I don’t have to make any conversions and using statements etc. in VS, and I can just use them directly as RevitAPI `Room` Elements.

Hope it’s clearer and maybe you have some insight.  
Thanks!

---

<div class="post-metadata">

**Author:** ![SeanP](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/seanp/32/42560_2.png) [@SeanP](https://forum.dynamobim.com/u/SeanP)\
**Post date:** [July 25, 2020, 11:27am UTC](https://forum.dynamobim.com/t/issue-with-unwrapping-room-element-from-lunchbox/53204/8 "2020-07-25T11:27:46Z")

</div>

The e.InternalElement will happen inside the ZTN, not in Python. I think your fighting a battle for no reason. The point of reference dll in VS is to do just exactly what you asking for.

This example just gets adjusted for rooms INSIDE your VS:

```
Internal void DoSomething(List<Revit.Elements.Room> rooms)
{
  //get Revit room element from the Dynamo-wrapped object
for(Revit.Elements.Room rm in rooms)
{
Autodesk.Revit.DB.Architecture.Room revitRoom = rm.InternalElement;
}
}
```

---

<div class="post-metadata">

**Author:** ![yafim.simanovsky](https://avatars.discourse-cdn.com/v4/letter/y/f17d59/32.png) [@yafim.simanovsky](https://forum.dynamobim.com/u/yafim.simanovsky)\
**Post date:** [July 25, 2020, 2:26pm UTC](https://forum.dynamobim.com/t/issue-with-unwrapping-room-element-from-lunchbox/53204/9 "2020-07-25T14:26:39Z")

</div>

Thanks @SeanP, I was using e.InternalElement in the ZTN, not in Python 🙂  
It still gave me an error but I think it was something else in my code, so I rewrote the definition and now it’s all good.  
Specifically the solution was:

```
using DynamoRoom = Revit.Elements.Room;

public static string GetData(Document document, List<DynamoRoom> inputRooms)
        {
            List<Room> revitRooms = new List<Room>();
            foreach (DynamoRoom dynRoom in inputRooms)
            {
                revitRooms.Add(dynRoom.InternalElement as Room);
            }
```
