How can I group points by their Z value and draw a nurbs curve between them?

I have 50 points as seen in the screen capture. There are five different Z values between all the points, 10 points at each Z value.

I trying to figure out a way to group the points into five groups, each group having the same Z value.

I then need to draw a nurbs curve between the points in each group, yielding 5 nurbs curves. The finaly step will be lofting all five lines together to create a surface.

I appreciate any help!

Post code!

Thank you!

Dear all,
I follow the same code but can not get the result. Could you please help to check if there’s any mistake. Kindly check gh. file and capture as below.
Thank you.


Ok, found it, reason: tolerance of z values, just need to round them up.