Unroll Curve to Z axis


Please check out attached file. How to get curves unrolled easiest from the complex shape to simple z-axis layered curves.
I made that rotating every single curves to z axis. It took some time and this was just a simple sample. In real life I have hundreds or even thousands curves to get to z-layer. Dimensions should stay equal.

unroll curves sample.3dm (54.8 KB)

I was thinking to extrude curves and then unroll curves with surfaces but that will take some time to extrude all the curves…

Wish to hear some tips how you would do that.

Best Regards: Wagner

PS: This is cable harness :slight_smile:

Hi! Set the contraction plane vertically (CPlane command).

do you need each point to be an interruption of the lines? either way the only idea i can contribute is to use remap cplane for the orthogonal lines from each appropriate view, and the others you have to manually rotate or read out the length and recreate. maybe it has sense writing a little python script if you are dealing with a lot of curves. reading into python may still be faster then.

but why would you need that, maybe there is another solution which suits your needs even better?

Hi Wagner - here’s a quick Python that may help - is that about the right thing? Save the .py, then Use RunPythonScript to test.

StraightenPolyline.py (1.1 KB)

Thank you everybody trying to help me! I appreciate it.

Pascal that is great python! Not Perfect but great! Saves a lot of my time, Thank You!
How to run python script without “RunPythonScript” and then go to downloaded folder and choose the script from there?
If it is easy to tune script, it would be great to have same coloured result like the original. If it is big job, I can live with this :slight_smile:


Hi Wagner - yep, try this one

StraightenPolyline.py (1.1 KB)

To run it from an alias or button, use a macro

_-RunPythonScript "Full path to py file in double-quotes"


Thank you very much Pascal! I admire your skills :slight_smile:

One more thing I noticed about the script.
It works only with straight curves. It does not work with rounded/curved curves.

I made an other same kind of sample, maybe it is too difficult to get in to real life. It’s ok if too difficult, but awesome if possible to make without using days/weeks…
unroll curves sample 2.3dm (649.9 KB)

Is it possible to make a button for python script? Just press the button and it works without “RunPythonScript”-> choose folder, choose downloaded script etc…

Anyway, this allready saves a lot of my time!


Hi Wagner - yeah, I made it work on polylines, since that is what you had in your file I’ll see about making it work on polycurves in general.
Looking at your file, though, it looks like you’re not even dealing with polycurves but randomly self-intersecting curves - that is not really what you mean is it?

See my description above for how to run a python script from a button.

Here is a version that will straighten more curve types:StraightenCurves.py (1.2 KB)

Hi Pascal!

Thank you very much! Now it works well for me :slight_smile:
Great customer support!

Yes I did my sample fast and tried to use couple different line/curve types. Electric cable is never straight so that’s exact enough… I think we will draw electric harnesses with Interpolate Curves…

I’m very Happy to continue working now :slight_smile:

One more time, Thank You!


One more thing I noticed:

It will not straighten single straight curve, because it asks “polycurve”. (cyan)
But it straigtens single curved curve. (green)

Is there some Rhino command to straighten single straight ones?

If 2 straight curves added to be polycurve, it will make it.
In white polycurve, there was straight line inside the polycurve and it made it great.

Does it has to be 2 or several scripts or is it possible to include to the one script?
I mean no matter, what kind of (single/poly/curved/straight) curve/line, it still makes it…


Hi Wagner - that should work on a single curve - I did not update the prompt - anyway I’ll check it.

@Wagner - I did leave out the single line case - that is added here:

StraightenCurves.py (1.3 KB)


i assume this may not fully work, you wrote
else: retrurn and if not line: retrurn

Indeed… thanks - fixed above.


Awesome, now it works great!

Thank You!