Script to extract centerline of imported geometry - Rhino 6

Hi everyone,

I am wanting to use the centerline of some imported geometry (simple constant circular sweep) to use as a base to start some surfacing I need to fit onto the imported model. Does anyone know if Rhino 6 has a function to do this?.. Maybe someone knows how to write a script for it?.. I can extract the wireframe mesh, but there is no centerline!!

It would be a wonderfully helpful addition to be able to do this with imported geometry, and give a very useful way to rapidly and accurately integrate with new geometry made in Rhino.

Many thanks.

Hi Michael - if the object is a revolve, then the Cen Osnap will find the centers of any revolved edges - i.e. arcs for a partial revolve, circles for a full revolve (e.g. Line command, snap to the Cen of two circular edges.) - is that what you mean?

-Pascal

Thanks Pascal. The swept part is a polyline with fillets on it s it’s not quite as simple as that. Does your idea work for this?..

Hi Michael - any edge that is a revolved one should work:

If there are none, try DivideAlongCreases > SplitAtTangents=Yes.

image

-Pascal

Thanks Pascal, I have attached n image of the profile I am trying to get a centerline with to give you an idea…

Ah - a pipe, not a revolve sorry, I misinterpreted - on that you can actually do the same kind of thing - the little circles have centers, and the arc shaped pieces have centers as well on the edge that is along the arc.So you should be able to piece together arcs and lines.

You can try this plug-in -
ExtractCenterline.rhp (19.5 KB)

Unblock it in Windows Explorer then drag and drop it onto Rhino - the command is (if I remember right) ExtractCenterline

-Pascal

A script is exactly what I need, but this one is constantly causing Rhino 6 to crash… Mmmmmm.

Hmm indeed - that’s new, this thing has been pretty reliable it seems to me … can you send me or post the object?
It’s working here…
Yeah, it does not like your object… I’ll investigate. Thanks.

@michael8 - the objects are blocks - use ExplodeBlock on them first. I’ll tune the tool up to either deal correctly with blocks or filter them at selection time. Also, I noticed that although the thing allows multiple selections, it only actually does one surface at a time, apparently I did not finish typing…

-Pascal

Thanks Pascal, I look forward to using the revised script. Cheers.

Hello @pascal Do you have by any chance any updates of your plugin ?
Thanks

@Giovanni_Ruotolo - this one should do OK with blocks - at least top level ones. (don’t forget to un-block the plug-in)

ExtractCenterline.rhp (19 KB)

-Pascal

Hi Pascal,

I just saw this…what method(s) do you use to figure out the centerlines? The plugin works, but it doesn’t work on 900 at once(generally simple capped cylinders, or some weirdly created surfaces that explode the cylinder into 2 surfaces) I could probably hack it out myself if I knew the apporach…it’s entirely possible I’ve done this already and just need my memory jogged…

Hi Jim - I will take a look - but as I recall the input is a face - it might be that handing it a pile of breps with multiple faces might confuse it - I’ll have a look .

-Pascal

If I feed it 300 cylinders I get…2 lines…which is weird that it’s not all of them or one?

Yeah, I busted something - thanks for the heads up, I’ll fix it…
For one thing, I see I am allowing but not handling extrusions…
@JimCarruthers , @Giovanni_Ruotolo - updated above - see if that works any better…

-Pascal

Hi Pascal,

Thanks that works, just as I was about to get my own working…the only issue I have is that the weird way whoever made these cylinders did it(artifact of DWG export and Import maybe?) I get 2 lines for each cylinder (that explodes into 2 semi-cylinders) and selDup doesn’t find them all…but that’s entirely unrelated. I wound up using my own for this job.

1 Like

Is it possible to extract center curves in single click?
Multi curves in single time

The current script doesnt work on a continous pipe objects but as you see extract only one segment at a time.

Would you be able to share the unzipped script to this plugin?
That or is there a way to be able to edit a .rhp file?

The current version does not allow for multiple segments which makes large piping arrangements a pain to deal with.

Hi William - this allows multiple selections and should ‘process’ them all in one go, but selection is still at the subobject level. It should be quite possible to allow polysurface selections.

ExtractCenterline.py (6.4 KB)

-Pascal

1 Like