# Relative coordinates of Points in Dynamo

**URL:** <https://forum.dynamobim.com/t/relative-coordinates-of-points-in-dynamo/22232>\
**Category:** Geometry\
**Tags:** dynamo\
**Created:** [May 25, 2018, 6:09pm UTC](https://forum.dynamobim.com/t/relative-coordinates-of-points-in-dynamo/22232 "2018-05-25T18:09:03Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![m.shcheblykin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/m.shcheblykin/32/92853_2.png) [@m.shcheblykin](https://forum.dynamobim.com/u/m.shcheblykin)\
**Post date:** [May 25, 2018, 6:09pm UTC](https://forum.dynamobim.com/t/relative-coordinates-of-points-in-dynamo/22232/1 "2018-05-25T18:09:03Z")

</div>

Hello. I’m trying to find a better way how to sort 4 points sets for paneling with Dynamo **(adaptive families)**. Do you have any ideas how I can get relative coordinates of already existing points?  
How can I get here the coordinates of the point from, lets say, new origin? Eventually It must work with thousands of points sets where each will get it’s new origin…

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/d/1d28d69fb14386ea989a6b3a2f3378340a464582.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 25, 2018, 7:00pm UTC](https://forum.dynamobim.com/t/relative-coordinates-of-points-in-dynamo/22232/2 "2018-05-25T19:00:50Z")

</div>

This post might be helpful.

> [@Point Coordinate System](https://forum.dynamobim.com/t/point-coordinate-system/21166):
>
> Hello all, thank you in advance. I have a simple&basic and embracing questions First of all how can i see a coordinate system icons of points ? like this at the moment it is hard to foresee how components will be aligned without seeing this coordinate systems. Second question, lets say i want to extract one coordinate system from one point and empose it to all other points.I am hoping that this will place all adaptive components to the points in same manner. Somewhere i make a m…

If you create your points from different coordinate systems you should be able to get their relative coordinates. I’m wondering if this is even necessary if you keep your panel points in sublists though.

---

<div class="post-metadata">

**Author:** ![m.shcheblykin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/m.shcheblykin/32/92853_2.png) [@m.shcheblykin](https://forum.dynamobim.com/u/m.shcheblykin)\
**Post date:** [May 25, 2018, 7:17pm UTC](https://forum.dynamobim.com/t/relative-coordinates-of-points-in-dynamo/22232/3 "2018-05-25T19:17:23Z")

</div>

Its necessary because I’m working with surfaces that were created in other software like Rhino, AutoCAD etc.  
And Vertices Points of surfaces sorted in random orders in sub lists. So for paneling with adaptive families its crucial to have all of them in the right order.

I didn’t create anything from different coordinate systems. I just import geometry, regenerate it in dynamo…

---

<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 25, 2018, 9:15pm UTC](https://forum.dynamobim.com/t/relative-coordinates-of-points-in-dynamo/22232/4 "2018-05-25T21:15:41Z")

</div>

But if your vertices are in sublists you should be able to keep them in sublists. I think there’s a node to order points clockwise or something similar. I believe if you patch the points into a polygon then get the vertices again in Dynamo they should be returned in order.

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [May 25, 2018, 9:23pm UTC](https://forum.dynamobim.com/t/relative-coordinates-of-points-in-dynamo/22232/5 "2018-05-25T21:23:44Z")

</div>

Would converting the points to UVs be easier?

---

<div class="post-metadata">

**Author:** ![m.shcheblykin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/m.shcheblykin/32/92853_2.png) [@m.shcheblykin](https://forum.dynamobim.com/u/m.shcheblykin)\
**Post date:** [May 25, 2018, 9:33pm UTC](https://forum.dynamobim.com/t/relative-coordinates-of-points-in-dynamo/22232/6 "2018-05-25T21:33:04Z")

</div>

I will check this concept

> [@Return A List of Points From Intersect That Create a Clockwise Polygon](https://forum.dynamobim.com/t/return-a-list-of-points-from-intersect-that-create-a-clockwise-polygon/5161):
>
> Does anyone have an example of how to sort points retrieved from intersection of geometry into a ordered list of points either clockwise or counterclockwise that forms a closed polygon. Trying to avoid self crossing polygon.

---

<div class="post-metadata">

**Author:** ![m.shcheblykin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/m.shcheblykin/32/92853_2.png) [@m.shcheblykin](https://forum.dynamobim.com/u/m.shcheblykin)\
**Post date:** [May 26, 2018, 12:09pm UTC](https://forum.dynamobim.com/t/relative-coordinates-of-points-in-dynamo/22232/7 "2018-05-26T12:09:04Z")

</div>

This is what I usually get for UV points when I start with external geometry ![Untitled](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/e/ee537f3ff9701f60568af1392572d12b7da441bd.jpg)

I think I should create a topic for developers where this Dynamo issuer will be fully explained

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [May 26, 2018, 12:31pm UTC](https://forum.dynamobim.com/t/relative-coordinates-of-points-in-dynamo/22232/8 "2018-05-26T12:31:24Z")

</div>

I thought you already had the points and surfaces, so you would be able to do Surface.UVAtPoints, which would allow for faster computing. Would love to see the write up in question though.

---

<div class="post-metadata">

**Author:** ![Vikram\_Subbaiah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vikram_subbaiah/32/50797_2.png) [@Vikram\_Subbaiah](https://forum.dynamobim.com/u/Vikram_Subbaiah)\
**Post date:** [May 27, 2018, 6:55am UTC](https://forum.dynamobim.com/t/relative-coordinates-of-points-in-dynamo/22232/9 "2018-05-27T06:55:02Z")

</div>

> [@m.shcheblykin](#):
>
> how to sort 4 points sets for paneling with Dynamo **(adaptive families)**

Assuming you want to sequence points such that they create a non-intersecting boundary, see if this works for you…

 ![boundaryCurve](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/c/9c60b623f0fe30288cc12d19d145564bc314a977.png)  
[boundaryCurve.dyn](https://forum.dynamobim.com/uploads/short-url/vEvhgBvgO67RfSD9HZvVxOH5yDz.dyn) (14.2 KB)

```
def seq(pt:var[])
{
	ct = Point.ByCoordinates(Math.Sum(pt.X)/List.Count(pt),Math.Sum(pt.Y)/List.Count(pt));
	qa = Math.Round(Vector.ByTwoPoints(ct,pt).Normalized().AngleAboutAxis(Vector.YAxis(),Vector.ZAxis()));
	q1 = List.GroupByKey(List.SortByKey(pt,qa)["sorted list"],List.SortByKey(pt,qa)["sorted keys"])["groups"];
	q2 = List.Flatten(List.SortByKey(q1<1>,(Point.ByCoordinates(q1.X,q1.Y).DistanceTo(ct))<1>)["sorted list"],-1);
	return = q2;
};
pt1 = seq(pts);

```

---

<div class="post-metadata">

**Author:** ![m.shcheblykin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/m.shcheblykin/32/92853_2.png) [@m.shcheblykin](https://forum.dynamobim.com/u/m.shcheblykin)\
**Post date:** [May 28, 2018, 5:43pm UTC](https://forum.dynamobim.com/t/relative-coordinates-of-points-in-dynamo/22232/10 "2018-05-28T17:43:22Z")

</div>

Hello Mr.Vikram  
Thank you so much for this logic with vector angle. I have learned a new way of data arrangement. I have studied your script very thoughtful and I would like to ask about q1 and q2.  
Actually it works already at q1 with out List.GroupByKey node that you assigned at the very beginning of its row.  
So starting from the List.GroupByKey node and all q2 is designed for cases where we have a lot of points close to each other in another words its an insurance for all possible cases. Am I right ?

 ![Capture](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/3/23e01d7962cd3c0f8d13c10b931ccbb00d98e21c.png)  
here I Just put your script in more readable form

---

<div class="post-metadata">

**Author:** ![Vikram\_Subbaiah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vikram_subbaiah/32/50797_2.png) [@Vikram\_Subbaiah](https://forum.dynamobim.com/u/Vikram_Subbaiah)\
**Post date:** [June 4, 2018, 5:45pm UTC](https://forum.dynamobim.com/t/relative-coordinates-of-points-in-dynamo/22232/11 "2018-06-04T17:45:38Z")

</div>

> [@m.shcheblykin](#):
>
> q2 is designed for cases where we have a lot of points close to each other in another words its an insurance for all possible cases. Am I right ?

Yes, I suppose 🙂  
Helps ensure it works even with numerous points …

 ![boundaryCurve](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/1/31e978c8b28db7fd04a73bb0c3eceb3794ccdad7.gif)

---

<div class="post-metadata">

**Author:** ![p.smithSTNZ](https://avatars.discourse-cdn.com/v4/letter/p/ccd318/32.png) [@p.smithSTNZ](https://forum.dynamobim.com/u/p.smithSTNZ)\
**Post date:** [November 26, 2020, 8:01am UTC](https://forum.dynamobim.com/t/relative-coordinates-of-points-in-dynamo/22232/12 "2020-11-26T08:01:52Z")

</div>

this was a huge help for a problem I had Vikram, thanks

---

<div class="post-metadata">

**Author:** ![shashank.baganeACM](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@shashank.baganeACM](https://forum.dynamobim.com/u/shashank.baganeACM)\
**Post date:** [April 28, 2022, 3:24pm UTC](https://forum.dynamobim.com/t/relative-coordinates-of-points-in-dynamo/22232/13 "2022-04-28T15:24:32Z")

</div>

Hi @Vikram_Subbaiah I am getting this error

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

can you please tell me why ?

---

<div class="post-metadata">

**Author:** ![Vikram\_Subbaiah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vikram_subbaiah/32/50797_2.png) [@Vikram\_Subbaiah](https://forum.dynamobim.com/u/Vikram_Subbaiah)\
**Post date:** [April 28, 2022, 4:21pm UTC](https://forum.dynamobim.com/t/relative-coordinates-of-points-in-dynamo/22232/14 "2022-04-28T16:21:34Z")

</div>

_List_ seems to have a conflict with other installed packages.  
Prefix _List_ with _DSCore._ (or use the code below, if you’re using a more recent Dynamo version)

```auto
def seq(pt:var[])
{
	ct = Point.ByCoordinates(Math.Sum(pt.X)/DSCore.List.Count(pt),Math.Sum(pt.Y)/DSCore.List.Count(pt));
	qa = Math.Round(Vector.ByTwoPoints(ct,pt).Normalized().AngleAboutAxis(Vector.YAxis(),Vector.ZAxis()));
	q1 = DSCore.List.GroupByKey(List.SortByKey(pt,qa)["sortedList"],DSCore.List.SortByKey(pt,qa)["sortedKeys"])["groups"];
	q2 = DSCore.List.Flatten(DSCore.List.SortByKey(q1<1>,(Point.ByCoordinates(q1.X,q1.Y).DistanceTo(ct))<1>)["sortedList"],-1);
	return q2;
};
pt1 = seq(pts);

```

---

<div class="post-metadata">

**Author:** ![shashank.baganeACM](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@shashank.baganeACM](https://forum.dynamobim.com/u/shashank.baganeACM)\
**Post date:** [May 2, 2022, 5:35am UTC](https://forum.dynamobim.com/t/relative-coordinates-of-points-in-dynamo/22232/15 "2022-05-02T05:35:27Z")

</div>

Got it @Vikram_Subbaiah Thank you so much

---

<div class="post-metadata">

**Author:** ![sandeep.bhatia439](https://avatars.discourse-cdn.com/v4/letter/s/22d042/32.png) [@sandeep.bhatia439](https://forum.dynamobim.com/u/sandeep.bhatia439)\
**Post date:** [July 18, 2024, 8:43am UTC](https://forum.dynamobim.com/t/relative-coordinates-of-points-in-dynamo/22232/16 "2024-07-18T08:43:06Z")

</div>

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/3/c342cff3f018e8127c92451a4fdffa55cc30a32f.png)  
Hi Vikram,  
I am trying to use your code to sort out the points to create a closed polygon. But I am getting these warnings. Can you please help?  
Its Revit 2024.2 and Dynamo 2.19.3  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [July 18, 2024, 8:51am UTC](https://forum.dynamobim.com/t/relative-coordinates-of-points-in-dynamo/22232/17 "2024-07-18T08:51:05Z")

</div>

Either uninstall Wombat or prefix each use of “Point” and “Vector” with some portion of `Autodesk.DesignScript.Geometry.` (starting with `Geometry.` and if that doesn’t work try `DesignScript.Geometry` and then `Autodesk.DesignScript.Geometry.`).

---

<div class="post-metadata">

**Author:** ![sandeep.bhatia439](https://avatars.discourse-cdn.com/v4/letter/s/22d042/32.png) [@sandeep.bhatia439](https://forum.dynamobim.com/u/sandeep.bhatia439)\
**Post date:** [July 18, 2024, 9:03am UTC](https://forum.dynamobim.com/t/relative-coordinates-of-points-in-dynamo/22232/18 "2024-07-18T09:03:32Z")

</div>

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/a/3a67ab547e23931aa0e31fd96987d7087450713a.png)  
Thanks @jacob.small. The warning is gone by using any of the prefixes you mentioned but its not providing any output.

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [July 18, 2024, 9:57am UTC](https://forum.dynamobim.com/t/relative-coordinates-of-points-in-dynamo/22232/19 "2024-07-18T09:57:14Z")

</div>

lines 3 to 6 out of the code block and paste them into a new one. That should expose the warning that’s being repressed by the definition at the moment.
