Extract Pipe Center Curve Script?

Thanks @pascal want give it a try but says unblock, which I did. Anyways it says still the same

Hi Hannes,

Did you unblock like so:


Works like a charm — thanks @pascal ! Although there are slight differences in spans of the resulting pipes related to increased point count — never mind :wink:

@hannesgrebin, all, I messed around a little more with this -

ExtractCenterline.rhp (15 KB)

  • the command is now ExtractCenterline - it should work on any surface that has a constant curvature in one direction, like a pipe, (including cylinders, torii and spheres -returns a point in that case) as well as cones. Currently some cylindrical shapes will end up with the line in the wrong direction… working on that.

  • added SurfaceRadius command to get the radius of any of the above surfaces at the pick point - handy for measuring fillet radii quickly. In the case of torus-like surfaces it reports the smaller radius.

PipeRadius.py (2.6 KB)
ExtractCenterline.py (3.7 KB)

It should work in V5 SR 9 and later.
Let me know what I did wrong…


Thanks so much @pascal will give it a try now!! thxH

@pascal, this works beautifully. surface radius command is really nifty as you said with all fillets. One question, is there a proper technique to reverse engineer the curve exact flow and point count matching the original curve? Rebuild curve wouldn’t work as we know. Thanks for your oppinion! H

HI Hannes- I do not see a way to get back to the input curve. That structure is long gone and all the attempts to get back to the right shape involve refitting.


@pascal encountered with the ExtractCenterline.rhp it wouldn’t extract the centerline as expected… Maybe you could check — thanks H (actually I wanted to extract the centerline to repeat the rounded chamfer in the lamps base)

Boho Baskets Standlampe.3dm (1.0 MB)

Yeah… the thing works per face, and for torii returns the full circle I guess… I’ll see if I can tune that up. If you MergeSrf, Smooth=No all the segments into one surface, it does get the centerline correctly.


  • make it work on polysurfaces where possible - it might be hard to detect when it makes sense.
  • get only the relevant part of partial torii
  • fix the cylinder cl being offset sometimes.

@hannesgrebin, please try this version - it still does not work on polysurfaces but it should get the right answers for the pipe segments in your example. Let me know… & thanks for the feedback.

ExtractCenterline.rhp (19.5 KB)
ExtractCenterline.py (6.6 KB)

@hannesgrebin - script and plug-in updated here to accommodate tapered pipes…

PipeRadius.py (2.6 KB)


@pascal will do it and come back: is ExtractCenterline.rhp1 (17 KB) and ExtractCenterline.py1 (4.7 KB) the same? What is better to deal with or is this equal? thanks for your efforts — it truly enhances my daily workflow so much! H

HI Hannes- they do the same thing, the rhp has both of the py scripts in it, it’s just more convenient to use- I posted the underlying scripts in case someone wants to play with them and make them better, or use them on Rhino for Mac which does not run rhp files.


Hi all, did anyone tested ExtractCenterline plugin on current Rhino 6 relase?
I am a power user of this plugin on R5.0 ad i just upgraded to 6.
On my experience works only on torus; on cilinder recognize the shape but dont draw any axis, and often crashes.
Thanks for your support!

Hello - I’ll make another pass through this thing - I see that it does not make cls for cylinders, at least in V6. It does seem to work on ‘freeform’ and other pipes. If you can post a couple of examples, that will make it easier to troubleshoot. Thanks.


Hi Pascal, in the example attached you’ll notice diverse strange behaviours: some cylinder are recognized as cones and a nearly infinite monodirectional axis are placed; on torus everything works fine, on cylinders no axis are drawn, trying to use “SurfaceRadius”
rhino crash immediatly…
Thanks pipe test.3dm (580.4 KB)

Great, thanks, I’ll have a look.


Any news? Thanks! :relaxed:

Hi All,
if anyone can help about running issue, here you can find a sample wich shows the plug-in works well on torus, cones, but non with cylinders.
Thanks!extract_centerline_test.3dm (2.0 MB)

@f.corradini I’m checking this now - I see where the problem lies - thanks.

@f.corradini fixed for cylinders: ExtractCenterline.py (5.4 KB)

@hannesgrebin, @f.corradini the ExtractCenterline script and compiled plug-in (way above) are updated to work better with cylinders.


1 Like


HI Pascal

I would like to embed ExtractCenterline.py script in to a toolbar but i am not able to get it to run when i click the icon.

I embedded the script in a a new button , the script is closed between parentesis as shown below

-_RunPythonScript (
…your script …

when i click the button the _RunPythonScript command should be supposed to run i guess, point is that nothing happens, i just the see whole script text running through command bar but the script is not working.

would you please tell me the correct procedure to embed it ? thanks in advance