How can I renumber curves? I want to renumber the curves according to Z-axis

Hi everyone,

I have a series curves, one up one according to Z-axis. However, the number of the curves is not continuous in Z-axis. How can I renumber the curves?

How I show curve number:

renumber.3dm (229.2 KB)

if you’re bringing the curves from rhino in the first place, why not simply select them ‘in order’ (bottom to top or vice versa)?

I can’t open your R6 file in R5. What it looks like is that you want to sort the curves in Z-order? There are several ways to do that, easier done than explained.

Thank you Joseph!
renumber_v5.3dm (239.4 KB) Here I uploaded the v5 file.

Here’s the general idea using planar curves I created: (internalized) (10.1 KB)

Your curves, however, look more complicated… not planar and not all starting at the same place, so that could mix things up… standby.

OK, I divided each curve into ten points and used their Average (roughly center) for the sorting. The ‘Tree/List Viewer’ is just a trace tool for examining trees of geometry in a visual way. (126.5 KB)

All curves internalized, no need for Rhino file.

P.S. To explain further, Sort is sorting Z values and the Avr points (‘A’ input) and curves (‘B’ input) get sorted in the same sequence as the ‘K’ (Keys) input.

That’s a great job, Joseph!!
Thank you so much for your kind and prompt help!

Well, this isn’t infallible. Irregular curves could mix it up, requiring more effort to determine valid Z values to sort by. But this is the general idea.

The more I use it, the more I like it. Thanks again!

They Loft better when sorted, eh? :wink: But I see two areas that look ugly (twisted), even with “Align sections” enabled. Still needs work?

To get a clean Loft, I added an Anemone loop (white group) after sorting them in sequence. It flips each curve and adjusts its Seam (start/end point) to match its predecessor. No Loft options required. (131.8 KB)

P.S. This is what Loft produces at three stages of the model. Left to right, below:

  1. raw curves, unsorted
  2. curves sorted by Z value of Avr points
  3. sorted curves after Anemone with matching directions and seams


Wow…Joseph, your work is fantastic!! And thank you so much for your kindness! I really need some time to fully understand your code :).

1 Like

Hi Joseph,

Here is a new problem. As you see the pic, this kind of curves still has the problem of sorting. Coul you please help me have a look?

Thank you again!

curves.3dm (907.7 KB) (28.4 KB) )

There is no magical best solution that leaps to mind… Maybe sort the rings by the highest point on each ring? Seems to work, didn’t check all possible cases. (28.8 KB)

1 Like

Hi Joseph, thank you so much!!
Actually I had the same idea (find the higest point) of you… However, I can’t realize it in GH :).
I think your method can be suitable for most my cases.
Nice job!