# Lexicographic sorting

**URL:** <https://forum.dynamobim.com/t/lexicographic-sorting/16661>\
**Category:** Revit\
**Created:** [November 20, 2017, 1:17pm UTC](https://forum.dynamobim.com/t/lexicographic-sorting/16661 "2017-11-20T13:17:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ari\_Monteiro](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ari_monteiro/32/135094_2.png) [@Ari\_Monteiro](https://forum.dynamobim.com/u/Ari_Monteiro)\
**Post date:** [November 20, 2017, 1:17pm UTC](https://forum.dynamobim.com/t/lexicographic-sorting/16661/1 "2017-11-20T13:17:39Z")

</div>

Hi,

How can I sorting coordinates in lexicographic fashion on Dynamo?

Which nodes I can use for this?

For example, I have coordinates extrated from “location.point” property on families (e.g.: walls). So, I need sorting these coordinates and after fill the Mark property of these families.

Any suggestions?

---

<div class="post-metadata">

**Author:** ![Yna\_Db](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/yna_db/32/30641_2.png) [@Yna\_Db](https://forum.dynamobim.com/u/Yna_Db)\
**Post date:** [November 20, 2017, 1:22pm UTC](https://forum.dynamobim.com/t/lexicographic-sorting/16661/2 "2017-11-20T13:22:19Z")

</div>

Is this what you’re after?

> [@Sort Dynamo points by coordinates](https://forum.dynamobim.com/t/sort-dynamo-points-by-coordinates/10426):
>
> [http://image.prntscr.com/image/1d3ebd863adf490382ab2c2c5a008929.png](http://image.prntscr.com/image/1d3ebd863adf490382ab2c2c5a008929.png)

---

<div class="post-metadata">

**Author:** ![Ari\_Monteiro](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ari_monteiro/32/135094_2.png) [@Ari\_Monteiro](https://forum.dynamobim.com/u/Ari_Monteiro)\
**Post date:** [November 20, 2017, 1:45pm UTC](https://forum.dynamobim.com/t/lexicographic-sorting/16661/3 "2017-11-20T13:45:30Z")

</div>

Hi @Yna_Db!

This post is using Python and Design Scripting for solve lexicographic sorting.

Its my impression, or this problem can be solved only with textual languange?

How can I solve this problem using only standard Dynamo nodes?

---

<div class="post-metadata">

**Author:** ![Yna\_Db](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/yna_db/32/30641_2.png) [@Yna\_Db](https://forum.dynamobim.com/u/Yna_Db)\
**Post date:** [November 20, 2017, 1:47pm UTC](https://forum.dynamobim.com/t/lexicographic-sorting/16661/4 "2017-11-20T13:47:17Z")

</div>

There are other solutions to the issue exposed in the same thread, but for a better understanding of what you seek, an illustration would be welcome 🙂

---

<div class="post-metadata">

**Author:** ![Ari\_Monteiro](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ari_monteiro/32/135094_2.png) [@Ari\_Monteiro](https://forum.dynamobim.com/u/Ari_Monteiro)\
**Post date:** [November 20, 2017, 2:00pm UTC](https://forum.dynamobim.com/t/lexicographic-sorting/16661/5 "2017-11-20T14:00:11Z")

</div>

Well, I have some walls that I need sorting in clockwise order, like show in the figure below. I’m using the “Mark” property to put the wall number.

In this case, whats the better solution?

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

---

<div class="post-metadata">

**Author:** ![Tom\_James](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/tom_james/32/22277_2.png) [@Tom\_James](https://forum.dynamobim.com/u/Tom_James)\
**Post date:** [November 20, 2017, 2:57pm UTC](https://forum.dynamobim.com/t/lexicographic-sorting/16661/6 "2017-11-20T14:57:27Z")

</div>

Just thinking here,  
Find the centroid of the combined walls, create vectors from the centroid to the midpoint of each wall, sort the vector angles to Y vector, use geometry closet point?

---

<div class="post-metadata">

**Author:** ![Ari\_Monteiro](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ari_monteiro/32/135094_2.png) [@Ari\_Monteiro](https://forum.dynamobim.com/u/Ari_Monteiro)\
**Post date:** [November 20, 2017, 8:49pm UTC](https://forum.dynamobim.com/t/lexicographic-sorting/16661/7 "2017-11-20T20:49:23Z")

</div>

I think I was able to solve my problem using the graph below.

Logic works, but two warning messages are popping up. How do I avoid these messages?

![WallsNumbering2](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/7/17d5129a284956a091ba532644e3003a3f49d18e.png)

[AutoNumeraçãoParedes-R00.dyn](https://forum.dynamobim.com/uploads/short-url/tfBHXxI4QzLVjyxJUSpRYhYm9GU.dyn) (17.6 KB)
