# DoesIntersect Python problem

**URL:** <https://forum.dynamobim.com/t/doesintersect-python-problem/9627>\
**Category:** Revit\
**Tags:** revit, python\
**Created:** [February 15, 2017, 10:57am UTC](https://forum.dynamobim.com/t/doesintersect-python-problem/9627 "2017-02-15T10:57:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ansobr](https://avatars.discourse-cdn.com/v4/letter/a/ad7895/32.png) [@ansobr](https://forum.dynamobim.com/u/ansobr)\
**Post date:** [February 15, 2017, 10:57am UTC](https://forum.dynamobim.com/t/doesintersect-python-problem/9627/1 "2017-02-15T10:57:25Z")

</div>

Hello !

I’m facing a problem I can’t understand and solve…

I’m trying to get the openings of my Revit Model and to sort them following wich wall they are intersecting. I built a Dynamo program to try to check if a window is intersecting a wall and it perfectly works (see image below).

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

But I want to make it in a Python script so I can make the check for a list of walls and a list of openings. I wrote the code below, using the same functions as in the Dynamo program :

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/0/30734ba404618cad57a7295306fb0284f31127b0.png)

But I’m getting this error and I don’t understand what’s wrong…

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/f/df0de1240c07517c92bed7d43e29897ef139bd13.png)

Thank you for your help ! 🙂

---

<div class="post-metadata">

**Author:** ![T\_Pover](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/t_pover/32/19147_2.png) [@T\_Pover](https://forum.dynamobim.com/u/T_Pover)\
**Post date:** [February 15, 2017, 11:07am UTC](https://forum.dynamobim.com/t/doesintersect-python-problem/9627/2 "2017-02-15T11:07:14Z")

</div>

I think you should first try to unwrap the elements that are Revit elements, for example: the windows should be loaded into the script list this:  
windows = UnwrapElement(IN[1])

You can find out 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:** ![ansobr](https://avatars.discourse-cdn.com/v4/letter/a/ad7895/32.png) [@ansobr](https://forum.dynamobim.com/u/ansobr)\
**Post date:** [February 15, 2017, 1:23pm UTC](https://forum.dynamobim.com/t/doesintersect-python-problem/9627/3 "2017-02-15T13:23:17Z")

</div>

Thank you for your answer !

I noticed I forgot some parenthesis after BoundingBox(), ToCuboid(), etc so I added it and my code is now :

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/0/50a8284573c70018da0d76f8b34d135a8fa53d9e.png)

I’m now getting an other error :

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/d/2de97daad40e985d71597c82fb064d4e762194a2.png)

Or, when I “Unwrap” my windows like you explained, I’m getting :

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

Is there something I misunderstood ? 😕

---

<div class="post-metadata">

**Author:** ![T\_Pover](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/t_pover/32/19147_2.png) [@T\_Pover](https://forum.dynamobim.com/u/T_Pover)\
**Post date:** [February 15, 2017, 2:04pm UTC](https://forum.dynamobim.com/t/doesintersect-python-problem/9627/4 "2017-02-15T14:04:57Z")

</div>

Sorry, it’s not my field of expertise but I think you’re mistaking the Revit API with the Dynamo API.  
First of to get the boundingbox of an element with the Revit API you need query it by using it as property, so in this case you would need:

bb = win.BoundingBox

After that the ‘bb’ instance is a Revit boundingbox and not a Dynamo boundingbox, so using ToCuboid on it won’t work. You’ll need to take a look at [http://www.revitapidocs.com/2016/3c452286-57b1-40e2-2795-c90bff1fcec2.htm](http://www.revitapidocs.com/2016/3c452286-57b1-40e2-2795-c90bff1fcec2.htm) where you can find the members of the boundingbox.

For more info on using the Revit API to do clash detection you could take a look at these nodes from Bakery:

> **[Revit Element Clash Detection v1](https://dynamonodes.com/2016/07/13/revit-element-clash-detection-v1/)**
>
> We can easily use builtin nodes like Element.Geometry, Geometry.DoesIntersect and Geometry.Intersect to put together a simple clash detection process in Dynamo. However, these geometry nodes bring …

---

<div class="post-metadata">

**Author:** ![Kulkul](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kulkul/32/49801_2.png) [@Kulkul](https://forum.dynamobim.com/u/Kulkul)\
**Post date:** [February 15, 2017, 2:27pm UTC](https://forum.dynamobim.com/t/doesintersect-python-problem/9627/5 "2017-02-15T14:27:36Z")

</div>

Hi @ansobr

There is a custom node from clockwork package called “Element.Inserts” that will give you openings.

![](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/3X/1/a/1ad15ec75bf5385f11a2cc3f58dc091c88fc3732.jpg)
