Extract Pipe Center Curve Script?

Hey all! found this one in the old forums Rhino - Rhino - Search Results
@pascal your script doesn’t work anymore in V5 64bit; tween curves works - any update to the script so far? would be very handy thanks H!

1 Like

Hi Hannes - the script works here so far - it works on a surface not a polysurface though. Can you post or send me an example where it fails?

thanks,

-Pascal

Maybe there is an option to extract the isocurves, calculate their area centroid and draw a curve through all points to generate the original curve of a pipe…

Find the Tween command most handy on pipes so far…

Hi Hannes - OffsetNormal of an extracted isocurve is also a good workaround - set the offset distance to the radius of the pipe.

-Pascal

@pascal indeed!!! thanks man!

Here’s a Python that does this… ExtractPipeCL.py (1.8 KB)

‘slightly’ tested…

Plug-in-ized: ExtractPipeCL.rhp (9 KB)
(Command = ExtractPipeCL)
-Pascal

1 Like

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:

-Willem

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…

-Pascal

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

@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.

So-

  • 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

@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.

-Pascal

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.

-Pascal

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)