Generating curve from tubular shape

Hi all, i would like to know if there is a command to get back the generating curve from a tube shape .
It would be very helpful because many times if someone draws a tubular from a generating curve , and then for some reason deletes the curve, modifying that tube becomes very difficult.

In order to get back the curve now i creates 2 opposite isocurves at the sides of the tube, than create a intermediate curve .

Is there a quick command?

You can try script written by Pascal

Thank you for suggestion. Unfortunately,the command gives a curve non properly located.
You can see in yellow the real curve generated using the “manual” method, and the other is generated using the script. Of course creating a new tubular shape using last one the solid is created in another positionù

Hello - can you post that surface? I’ll take a look.

-Pascal

Hi Pascal , yes, please see it in attached
Thankspipe.3dm (1.7 MB)

Hello - the blue curve is what came in the file, I’m not sure what that is… the red one is the extracted centerline - does that look correct?

pipeCL_PG.3dm (561.0 KB)

-Pascal

please skip the blue curve. Yes, the red is the extracted, but as you can see, it is not the real generating curve

Hello -thanks, yeah, the pipe is not constant radius - that case is not handled but obviously I need to be able to detect it and tell the user.

-Pascal

You’re right, the pipe is tapered. Thank you for your help. It would be helpful having a command that runs also for non-constant radius tubes, by the way I noticed that intermediate curve from opposite isocurves runs well.

Hello - yes- finding the opposite isocurve is another way to get at this - it’s not as easy in a script, at least that is what I found when I made this thing originally but I’ll take another look - I have a thought or two about how to reliably find the opposite iso.

-Pascal

Or maybe something like this can be scripted:

Yeah - what the script does now is make normal offset at the radius - obviously wrong for a tapered pipe - but I think it is not hard to find the opposite iso and get a surface between - I think I prefer that as there’s no fuzz from an intersection operation - we’ll see how it works.

@akeswins, @Gijs - here’s a try at getting this working for tapered pipes. It might work…

ExtractCenterline.rhp (19.5 KB)

You’ll need to unblock the rhp file before dragging and dropping onto Rhino.

ExtractCenterline.py (6.6 KB)

@Gijs - script added here - it’s all pretty old except the last bit where the script decides there is no cylinder, cone, etc and falls back on it being a pipe - that is changed now to use a center isocurve of a loft between opposite isos rather than an offset normal to the middle of the pipe (original way)

-Pascal

2 Likes

Hi Pascal, thanks for that, for learning purposes can you post the code?

Thank you Pascal, now it runs well!

Awesome! Thanks!

Here is how I made it a dedicated command:

Text: Extract centerline from pipe
Tooltip: Extract centerline from pipe
Command: ! _ExtractCenterline

Icon:
ExtractCenterline

(I used the Pipe icon as a reference and simply drew a white spline with 1 pixel thickness over it)

1 Like

I wondered if alternatively, if you could reference the end seam of of the pipe, drawing intersecting planes, sectioning cross sectional curves, which you can find the centers of.

Yeah,… the down side of that sort of approach, I’d say, is that it does not take advantage of some known and exact information inherent in the pipe surface, and instead cooks up approximations. The curve generated by the script above should have exactly the structure of the pipe surface in that direction and therefore be as exactly right as I think it can be, if the original curve is missing. If you start intersecting and then interpolating centers you’re making two successive approximations - it might be close enough much of the time but it’s also a lot more typing. Reverse engineering a mesh pipe would require something like that approach though, as far as I can see.

-Pascal