Troubles to extract center line of a pipe/duct with SW geometry


I am reaching out to you guys because I just identified an issue when exporting files from solidworks.

The aim of my work right now is to generate the central axis of a given pipe / duct, the obtained curve is then divided into point in order to generate planes along that line using the points and their tangent along the curve. The central axis is obtained uising either TweenCurves directly or TweenSurfaces then TweenCurves

As can be seen on the picture, when I import geometries from solidworks the faces aren’t split along a common line, which is giving me issues further down the line. Is there a way to work around that?
Or maybe there is another way to generate a central line along the pipe/duct that I am not aware of.

I am still relatively new to Rhino but I have done researches on this specific subject for a while and couldn’t find anything related. Please let me know if this is unclear.

Thanks a lot, Tino

the other way to do this is to extract isocurves and join them, then mark the foci of the circles that result

if you do not get perfect circles, you can redraw them using 3pt circle snapped to the original.

you can then make CurveThroughPt to generate the line.


Kyle thank you very much for your quick reply, I will try it right now and tell you how it goes.

This would only be a temporary fix though as I want my process to be applicable to more complex geometries as follow :

This is why I am trying to find a procedure that relies on getting inputs from the cad file itself.

Thanks again, Tino.

ah, @pascal I seem to remember had a script for stuff like that. Unless I’m confused.

Your 2nd Screenshot does not look like a circular section ? More like a ellipse?

Make a copy
Shrinktrimmedsrf (optional)

Keep only the main surfaces - delete the rest of the copy

Twice per surface. Use knot or intersect snapping to get corresponding curves facing each other.

To get the middle/ center of both curves

Alternativ use
If radius is constant

Hello- Here’s something that might help - (4.0 KB)

To use the Python script use RunPythonScript, or a macro:

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