# Line Direction of closed boundaries

**URL:** <https://forum.dynamobim.com/t/line-direction-of-closed-boundaries/8188>\
**Category:** Geometry\
**Tags:** python, vector\
**Created:** [December 12, 2016, 6:16pm UTC](https://forum.dynamobim.com/t/line-direction-of-closed-boundaries/8188 "2016-12-12T18:16:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cesar\_Escalante2](https://avatars.discourse-cdn.com/v4/letter/c/c57346/32.png) [@Cesar\_Escalante2](https://forum.dynamobim.com/u/Cesar_Escalante2)\
**Post date:** [December 12, 2016, 6:16pm UTC](https://forum.dynamobim.com/t/line-direction-of-closed-boundaries/8188/1 "2016-12-12T18:16:28Z")

</div>

Given a closed chain of boundary lines in the same plane, each line displaying different vector line directions, is there a way to change all the lines’ vector direction so they all read as a chain of vectors in counterclockwise direction?

I found a graphic way to do this but it is really cumbersome: 1) convert the closed boundaries into a surface by patch, then 2) find the face vertices, 3) convert the vertices to point, 4) build a polycurve by points, 5) deconstruct the polycurve to lines, 6) and then find the line direction.

Any other suggestion?

---

<div class="post-metadata">

**Author:** ![Thomas\_Mahon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/thomas_mahon/32/64209_2.png) [@Thomas\_Mahon](https://forum.dynamobim.com/u/Thomas_Mahon)\
**Post date:** [December 12, 2016, 6:20pm UTC](https://forum.dynamobim.com/t/line-direction-of-closed-boundaries/8188/2 "2016-12-12T18:20:42Z")

</div>

Create a `PolyCurve.ByJoinedCurves`, then retrieve its curves using `PolyCurve.Curves`. This new list of lines should have a consistent/reliable vector direction.

---

<div class="post-metadata">

**Author:** ![Cesar\_Escalante2](https://avatars.discourse-cdn.com/v4/letter/c/c57346/32.png) [@Cesar\_Escalante2](https://forum.dynamobim.com/u/Cesar_Escalante2)\
**Post date:** [December 12, 2016, 7:19pm UTC](https://forum.dynamobim.com/t/line-direction-of-closed-boundaries/8188/3 "2016-12-12T19:19:35Z")

</div>

Thanks Thomas
