Point3d Array Orderby

Point3d Array Orderby

fsl88
Contributor Contributor
282 Views
0 Replies
Message 1 of 1

Point3d Array Orderby

fsl88
Contributor
Contributor

Hi

I need help in sorting my pos1[] array and saving to the sortedList[] array.

pos1 is a Point3d array,

 

Point3d[] pos1 = new Point3d[blockCount * 6];

 

My code after my pos1[] array are generated  is,

 

var sortedList = pos1.OrderBy(p => p.X).ThenBy(p => p.Y).ToArray();

 

 

 

for (int ff = 0; ff < nodeCount; ff++)
{
    ed.WriteMessage("\nsortedList[" + ff + "] = " + sortedList[ff]);
}

 

 Here are the sample of my results

fsl88_0-1628407442516.png   

fsl88_1-1628407510517.png

fsl88_2-1628407727388.png

 

(0,0,0) must not appear, sometime the sorting is good, like the last picture.

The sort must be like:

X values (lowest to highest) - PRIMARY

Y values (lowest to highest) - SECONDARY

 

Thanks

0 Likes
283 Views
0 Replies
Replies (0)