How to Get Centreline of Cylinder that is a Direct Shape?

Hello,

I have a bunch of DirectShape objects that are all basic cylinders. I want to be able to create a line through the centre of the cylinder.

So far, all I’m able to do is use Select Face and click the start and end faces. Then use Surface.PointAtParameter with numbs of 0.5 to get the centre point. Then use Line.ByStartPointEndPoint.

Probable is we have a ton of these cylinders. Is it possible to use select element to get the DS, then somehow convert it to something usable so I can draw a line using Line.ByStartPointEndPoint? (these seems pretty basic and I’m not sure why I can’t find the right node)

Hi @Matt_Fleming
Did you try Element.Geometry ?

1 Like

It will depend some on how your direct shapes were built, but…

Element.Faces > Surface.PerimeterCurves > List.Count to get the number of curves in each surface > filter out surfaces (not the curves) with more than 2 edges > Surface.PointAtParameter > LineByBestFitThroughPoints