Hi,
I don't see anything wrong in the code you posted (at least the algorythm part).
Maybe an accuracy issue, try rounding the coordinates:Code - C#: [Select]
mypointlist = mypointlist.OrderByDescending(pnt => math.Round(pnt.Y, 9)).ThenBy(pnt => Math.Round(pnt.X, 9)).ToList();
Assuming mypointlist type is List<Point3d> you can also use the List<T>.Sort() method (C# 6):Code - C#: [Select]
using static System.Math; // ... mypointlist.Sort((p1, p2) => Round(p1.Y, 9) == Round(p2.Y, 9) ? Round(p1.X, 9).CompareTo(Round(p2.X, 9)) : Round(p2.Y, 9).CompareTo(Round(p1.Y, 9)));
Hi,
I don't see anything wrong in the code you posted (at least the algorythm part).
Maybe an accuracy issue, try rounding the coordinates:Code - C#: [Select]
mypointlist = mypointlist.OrderByDescending(pnt => math.Round(pnt.Y, 9)).ThenBy(pnt => Math.Round(pnt.X, 9)).ToList();
Assuming mypointlist type is List<Point3d> you can also use the List<T>.Sort() method (C# 6):Code - C#: [Select]
using static System.Math; // ... mypointlist.Sort((p1, p2) => Round(p1.Y, 9) == Round(p2.Y, 9) ? Round(p1.X, 9).CompareTo(Round(p2.X, 9)) : Round(p2.Y, 9).CompareTo(Round(p1.Y, 9)));