# Group Points based on X & Y coordinates

Hi all,

I’m trying to group the points based on theier X & Y. I’m using Group by Key values but can do only x or Y. How can we put both conditions together? Group by function maybe??
The intent behind this grouping is, for elements it returns points on top and bottom edges of any element. By grouping this, and giving a condition to filter points with Z of point > Z of other point in the same group, whoch will give two list one for all bottom points and other for all top points.

Please take a look at the picture. Thanks!

Hi Rooney,

Edit: Note at the Lacing for “List.SortByKey”.

1 Like

@Rooney_Wayne The issue you’ve red lined in your image above can be resolved by limiting the Point.Y values to three decimal places (Math.Round)

1 Like

Thanks for the input. I think I was not able to project the problem properly. Please take a look at this picture below.

So basically each X,Y point will have two elevations for an element. I want to group them in that manner, so there will be sublists of indices 0,1 .Later we will group by index with 0 and 1. Basically generating all the top points of an element and all the bottom points of the same elements separately. This way user can choose what points he/she needs.

Sounds to me like you want to:

• SortByKey (Point.Y)
• SortByKey (Point.X)
• GroupByKey (Point.Z)
1 Like

You can extract X and Y with Point.X and Point.Y, and then feed this into UV.ByCoordinates and then group all your points with that.