# Get HostElement of a BoundaryConditions Element in Python

**URL:** <https://forum.dynamobim.com/t/get-hostelement-of-a-boundaryconditions-element-in-python/25393>\
**Category:** Developers\
**Created:** [August 30, 2018, 2:58pm UTC](https://forum.dynamobim.com/t/get-hostelement-of-a-boundaryconditions-element-in-python/25393 "2018-08-30T14:58:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![puschen121RFA2Q](https://avatars.discourse-cdn.com/v4/letter/p/f05b48/32.png) [@puschen121RFA2Q](https://forum.dynamobim.com/u/puschen121RFA2Q)\
**Post date:** [August 30, 2018, 2:58pm UTC](https://forum.dynamobim.com/t/get-hostelement-of-a-boundaryconditions-element-in-python/25393/1 "2018-08-30T14:58:27Z")

</div>

Hello,

I am new to using the Revit API and would like to get the HostElement of a BoundaryConditions Element in Python. Here is what I tried:

![grafik](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/6/066f63bd6d53ba931f398d909774d0df190edd63.png)

import clr  
clr.AddReference(‘ProtoGeometry’)  
from Autodesk.DesignScript.Geometry import \*  
import clr  
clr.AddReference(‘ProtoGeometry’)  
from Autodesk.DesignScript.Geometry import \*

# Import RevitNodes

clr.AddReference("RevitNodes")  
import Revit

# Import Revit elements

from Revit.Elements import \*

# Import DocumentManager

clr.AddReference("RevitServices")  
import RevitServices  
from RevitServices.Persistence import DocumentManager

import System

myBc = IN[0]

OUT = myBc.LevelId

Any tips on how to import the right ‘parts’ of the API?

Edit: I am using Revit 2016 and Dynamo 1.3

---

<div class="post-metadata">

**Author:** ![Alban\_de\_Chasteigner](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/alban_de_chasteigner/32/39650_2.png) [@Alban\_de\_Chasteigner](https://forum.dynamobim.com/u/Alban_de_Chasteigner)\
**Post date:** [August 30, 2018, 3:04pm UTC](https://forum.dynamobim.com/t/get-hostelement-of-a-boundaryconditions-element-in-python/25393/2 "2018-08-30T15:04:54Z")

</div>

Hi,

You can add the lines :

```
# Import RevitAPI
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

```

P.S : I’ve no idea if your script will work.

---

<div class="post-metadata">

**Author:** ![puschen121RFA2Q](https://avatars.discourse-cdn.com/v4/letter/p/f05b48/32.png) [@puschen121RFA2Q](https://forum.dynamobim.com/u/puschen121RFA2Q)\
**Post date:** [August 30, 2018, 4:24pm UTC](https://forum.dynamobim.com/t/get-hostelement-of-a-boundaryconditions-element-in-python/25393/3 "2018-08-30T16:24:19Z")

</div>

Hi Alban,

thank you for your answer, unfortunately I still get the same warning (I tried it with “LevelId” instead of “HostElement” in the original post)

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

---

<div class="post-metadata">

**Author:** ![Einar\_Raknes](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/einar_raknes/32/8566_2.png) [@Einar\_Raknes](https://forum.dynamobim.com/u/Einar_Raknes)\
**Post date:** [August 30, 2018, 6:36pm UTC](https://forum.dynamobim.com/t/get-hostelement-of-a-boundaryconditions-element-in-python/25393/4 "2018-08-30T18:36:52Z")

</div>

You need to import Autodesk.Revit.DB.Structure, and unwrap the element. Read about unwrapping and more here: [https://github.com/DynamoDS/Dynamo/wiki/Python-0.6.3-to-0.7.x-Migration](https://github.com/DynamoDS/Dynamo/wiki/Python-0.6.3-to-0.7.x-Migration)

---

<div class="post-metadata">

**Author:** ![puschen121RFA2Q](https://avatars.discourse-cdn.com/v4/letter/p/f05b48/32.png) [@puschen121RFA2Q](https://forum.dynamobim.com/u/puschen121RFA2Q)\
**Post date:** [August 31, 2018, 6:09am UTC](https://forum.dynamobim.com/t/get-hostelement-of-a-boundaryconditions-element-in-python/25393/5 "2018-08-31T06:09:39Z")

</div>

@Einar_Raknes thank you, that helps alot!
