You are describing a process similar to Mesh to Nurbs conversion, just one dimension lower.

This is problematic and non-trivial, because you are missing important information. A discrete representation does not mathematically describe a shape. One reason why serious engineering is done in Nurbs, not with Meshes/Polylines.

So how would you solve that problem? Well you would rebuild that shape manually. You decide the curve layout and the properties of each curve. This requires an iterative workflow and experience. Reverse engineering a shape is difficult, and a very common job description.

You can automate such tasks to a certain degree, but its a trade-off. There is no perfect algorithm, none of them are easy to implement.

I showed you 4 mathematical tools in doing so:

* approximation -> least square

* approximation -> iterative guessing

* interpolation -> de Boor algorithm in reverse

* degree lowering (perfect for single span representations, unsuited for you)

Applying Least Square approximation is the usual mathematic approach in fitting a shape and a central part of the regression analysis. Rhino offers this with **_FitCrv**.

The problem, you work with Nurbs which makes it difficult to implement that for yourself. If you don’t know what Nurbs are, then learn about it first.

I showed a book where this is all explained.

The **_rebuild** command is unsuited because it diverges strongly, doesn’t hold the continuity between multiple curves and it has a complete different purpose. The **_rebuild** command is used to in-/decrease controlpoint count, equally distribute them and as such to smooth out a shape.