# Sort point with Y and Z coordinates

**URL:** <https://forum.dynamobim.com/t/sort-point-with-y-and-z-coordinates/63669>\
**Category:** Geometry\
**Created:** [May 6, 2021, 1:28pm UTC](https://forum.dynamobim.com/t/sort-point-with-y-and-z-coordinates/63669 "2021-05-06T13:28:47Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![MariaLauraLeonardi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/marialauraleonardi/32/116254_2.png) [@MariaLauraLeonardi](https://forum.dynamobim.com/u/MariaLauraLeonardi)\
**Post date:** [May 6, 2021, 1:28pm UTC](https://forum.dynamobim.com/t/sort-point-with-y-and-z-coordinates/63669/1 "2021-05-06T13:28:47Z")

</div>

Hi! I am struggling with organizing this point according to their y and z as shown in the red. Every time I use sort by they never are in the crescent order. Do you know how to do it?

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/e/9e83e7aa732d5e19b0c26932e03e200fd61965d1.png)

---

<div class="post-metadata">

**Author:** ![\_Vijay](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/_vijay/32/91307_2.png) [@\_Vijay](https://forum.dynamobim.com/u/_Vijay)\
**Post date:** [May 6, 2021, 1:51pm UTC](https://forum.dynamobim.com/t/sort-point-with-y-and-z-coordinates/63669/2 "2021-05-06T13:51:07Z")

</div>

can you share the sample file and with how much you done?

---

<div class="post-metadata">

**Author:** ![MariaLauraLeonardi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/marialauraleonardi/32/116254_2.png) [@MariaLauraLeonardi](https://forum.dynamobim.com/u/MariaLauraLeonardi)\
**Post date:** [May 6, 2021, 2:02pm UTC](https://forum.dynamobim.com/t/sort-point-with-y-and-z-coordinates/63669/3 "2021-05-06T14:02:56Z")

</div>

So, first I sort by Z

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/9/0941d7d12579d2d751d5dcbf03079e69a8b16590.png)  
Then, I group by Y but as you can see there is no order at all  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/1/715be970abb936e5bd374ce9c85eee8dc37c7bdc.png)  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/6/a6a70ba717e7eb8c321c7a5076eabca4b520d2dc.png)  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/a/eaf15c87ee142039a48c021e7a90cd4a1cf2c106.png)

---

<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:** [May 6, 2021, 2:13pm UTC](https://forum.dynamobim.com/t/sort-point-with-y-and-z-coordinates/63669/4 "2021-05-06T14:13:41Z")

</div>

This scenario has been asked about many times before. Please try searching the forum for similar topics before starting a new one. You just need to apply the correct list levels.

---

<div class="post-metadata">

**Author:** ![MariaLauraLeonardi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/marialauraleonardi/32/116254_2.png) [@MariaLauraLeonardi](https://forum.dynamobim.com/u/MariaLauraLeonardi)\
**Post date:** [May 6, 2021, 2:18pm UTC](https://forum.dynamobim.com/t/sort-point-with-y-and-z-coordinates/63669/5 "2021-05-06T14:18:02Z")

</div>

I m not finding anything similar. Do you know where i can look for ? Or do u have any example?

---

<div class="post-metadata">

**Author:** ![Daan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/daan/32/82246_2.png) [@Daan](https://forum.dynamobim.com/u/Daan)\
**Post date:** [May 6, 2021, 2:21pm UTC](https://forum.dynamobim.com/t/sort-point-with-y-and-z-coordinates/63669/6 "2021-05-06T14:21:03Z")

</div>

give me a moment @MariaLauraLeonardi ,

i’ll create something for you

---

<div class="post-metadata">

**Author:** ![MariaLauraLeonardi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/marialauraleonardi/32/116254_2.png) [@MariaLauraLeonardi](https://forum.dynamobim.com/u/MariaLauraLeonardi)\
**Post date:** [May 6, 2021, 2:24pm UTC](https://forum.dynamobim.com/t/sort-point-with-y-and-z-coordinates/63669/7 "2021-05-06T14:24:19Z")

</div>

Thanks a lot

---

<div class="post-metadata">

**Author:** ![Daan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/daan/32/82246_2.png) [@Daan](https://forum.dynamobim.com/u/Daan)\
**Post date:** [May 6, 2021, 2:24pm UTC](https://forum.dynamobim.com/t/sort-point-with-y-and-z-coordinates/63669/8 "2021-05-06T14:24:55Z")

</div>

Take a look at this:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/7/4729e91d645eb1f3900000e4183c20c769ba71a8.png)

[2021-05-06 SortPointsByZThenY.dyn](https://forum.dynamobim.com/uploads/short-url/9oLsdwysAFGX7neuJp4ThgR45WM.dyn) (18.7 KB)

---

<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:** [May 6, 2021, 2:25pm UTC](https://forum.dynamobim.com/t/sort-point-with-y-and-z-coordinates/63669/9 "2021-05-06T14:25:08Z")

</div>

> [@Sorting points (by X and Y or natural)](https://forum.dynamobim.com/t/sorting-points-by-x-and-y-or-natural/38756/4):
>
> I am going to try a sort with if x=x , sort by y and if y=y sort by x , but when the x or y values are not the same (sometimes its a couple of mm different) then it wont work I think… Update: Solved the problem with the above method guys. Thanx for the reaction. The only thing is that either the x’s or y’s have to be the same. For the projects im doing thats oke.

> [@Sorting columns based on x and y points seem to end up in random order](https://forum.dynamobim.com/t/sorting-columns-based-on-x-and-y-points-seem-to-end-up-in-random-order/55101/4):
>
> I added a list flatten to the second point node and i got the script almost working i guess… The problem now is that the columns get named from bottom to top instead from top to bottom… [image] There seems to be more going on than just inverse numbering. I added a few columns and made the name a number instead of a letter

> [@Rename elements (beams,columns etc.) by X and Y direction](https://forum.dynamobim.com/t/rename-elements-beams-columns-etc-by-x-and-y-direction/9186/3):
>
> Hi @imran_raj1985 You need to first sort your elements by X and Y and then rename them. Below is an example.

It depends on what exactly you’re looking for, but those should get you started.

---

<div class="post-metadata">

**Author:** ![MariaLauraLeonardi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/marialauraleonardi/32/116254_2.png) [@MariaLauraLeonardi](https://forum.dynamobim.com/u/MariaLauraLeonardi)\
**Post date:** [May 6, 2021, 2:29pm UTC](https://forum.dynamobim.com/t/sort-point-with-y-and-z-coordinates/63669/10 "2021-05-06T14:29:11Z")

</div>

Thanks a lot! Is the node that you used the same as this?  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/4/d4656e0aebbe92ce8725ee036fecd9f854c7f4e6.png)  
because I see a little difference

---

<div class="post-metadata">

**Author:** ![Daan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/daan/32/82246_2.png) [@Daan](https://forum.dynamobim.com/u/Daan)\
**Post date:** [May 6, 2021, 2:36pm UTC](https://forum.dynamobim.com/t/sort-point-with-y-and-z-coordinates/63669/11 "2021-05-06T14:36:36Z")

</div>

Yes, i am just in a newer version of Dynamo

---

<div class="post-metadata">

**Author:** ![MariaLauraLeonardi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/marialauraleonardi/32/116254_2.png) [@MariaLauraLeonardi](https://forum.dynamobim.com/u/MariaLauraLeonardi)\
**Post date:** [May 6, 2021, 2:39pm UTC](https://forum.dynamobim.com/t/sort-point-with-y-and-z-coordinates/63669/12 "2021-05-06T14:39:15Z")

</div>

Unfortunately is not working ☹

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/b/abdeb3bce3720382694ca00a2c119868339e3777.png)

---

<div class="post-metadata">

**Author:** ![Daan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/daan/32/82246_2.png) [@Daan](https://forum.dynamobim.com/u/Daan)\
**Post date:** [May 6, 2021, 2:41pm UTC](https://forum.dynamobim.com/t/sort-point-with-y-and-z-coordinates/63669/13 "2021-05-06T14:41:05Z")

</div>

Are your Z-Values and Y-Values rounded?  
If not maybe you can use a Math.Round node in between. (Then you need to change the List.SortByFunction node to List.SortbyKey and get your key inputs from your list (with a Math.Round in between).

PS: you dont need to flatten / shuffle the list, i just added those in my script to show you that it works with any input

---

<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:** [May 6, 2021, 2:46pm UTC](https://forum.dynamobim.com/t/sort-point-with-y-and-z-coordinates/63669/14 "2021-05-06T14:46:24Z")

</div>

Always round your values when comparing. Dynamo makes precision issues at longer decimal lengths.

---

<div class="post-metadata">

**Author:** ![MariaLauraLeonardi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/marialauraleonardi/32/116254_2.png) [@MariaLauraLeonardi](https://forum.dynamobim.com/u/MariaLauraLeonardi)\
**Post date:** [May 6, 2021, 2:47pm UTC](https://forum.dynamobim.com/t/sort-point-with-y-and-z-coordinates/63669/15 "2021-05-06T14:47:36Z")

</div>

thanks, im trying

---

<div class="post-metadata">

**Author:** ![MariaLauraLeonardi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/marialauraleonardi/32/116254_2.png) [@MariaLauraLeonardi](https://forum.dynamobim.com/u/MariaLauraLeonardi)\
**Post date:** [May 6, 2021, 2:47pm UTC](https://forum.dynamobim.com/t/sort-point-with-y-and-z-coordinates/63669/16 "2021-05-06T14:47:48Z")

</div>

thanks

---

<div class="post-metadata">

**Author:** ![MariaLauraLeonardi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/marialauraleonardi/32/116254_2.png) [@MariaLauraLeonardi](https://forum.dynamobim.com/u/MariaLauraLeonardi)\
**Post date:** [May 6, 2021, 3:06pm UTC](https://forum.dynamobim.com/t/sort-point-with-y-and-z-coordinates/63669/17 "2021-05-06T15:06:31Z")

</div>

My issue with rounding is then that I put together these two z values  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/5/d547169b3a4368612f98a48d23baac7f0f3b2036.png)

I really dont know how to figure this out

---

<div class="post-metadata">

**Author:** ![Daan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/daan/32/82246_2.png) [@Daan](https://forum.dynamobim.com/u/Daan)\
**Post date:** [May 6, 2021, 3:08pm UTC](https://forum.dynamobim.com/t/sort-point-with-y-and-z-coordinates/63669/18 "2021-05-06T15:08:52Z")

</div>

Have you tried the Math.Round node where you can set your decimals?  
Maybe try setting it to 1 or 2 decimal points

---

<div class="post-metadata">

**Author:** ![MariaLauraLeonardi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/marialauraleonardi/32/116254_2.png) [@MariaLauraLeonardi](https://forum.dynamobim.com/u/MariaLauraLeonardi)\
**Post date:** [May 6, 2021, 3:18pm UTC](https://forum.dynamobim.com/t/sort-point-with-y-and-z-coordinates/63669/20 "2021-05-06T15:18:03Z")

</div>

sorry, i just see the problem

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/9/b9a90ac0c54f0b6efbc780fcd1c8b8013fe9a175.png)

---

<div class="post-metadata">

**Author:** ![MariaLauraLeonardi](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/marialauraleonardi/32/116254_2.png) [@MariaLauraLeonardi](https://forum.dynamobim.com/u/MariaLauraLeonardi)\
**Post date:** [May 6, 2021, 3:32pm UTC](https://forum.dynamobim.com/t/sort-point-with-y-and-z-coordinates/63669/21 "2021-05-06T15:32:35Z")

</div>

but i am having this final issue  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/9/d9edd812a674ae1c101e3ed1f4ca05a0438b1eeb.png)

[Next page](https://forum.dynamobim.com/t/sort-point-with-y-and-z-coordinates/63669.md?page=2)
