How can I make center line for a curved I section (Brep)

How can I make center line for curved section in grasshopper.

Find Center line.3dm (1.6 MB)

  1. Get the edges and find the longest that is not linear.
  2. Do perpendicular planes on that edge.
  3. Get the ccx Curves (Brep, Plane).
  4. From the array in 3 get the curve that is closest to plane origin (case: S shapes that yield more than one section etc).
  5. Get the centroid pts from the curves in 4. .
  6. Make an interpolated curve out of pts in 5.

In fact - and depending on Topology - is a bit more tricky (at the ccx events for plane.First() and Last()): you should insert/add the joined (linear) edges curve that is closest to the first, last plane.

1 Like

In his provided model, all the edges are linear.

I don’t work with R6 (so I can’t open the file) … but from the image attached (and the thread title) appears that we are talking about a sweep1 Brep (where rail: a curve).

It looks like it was imported from a sketchup model or something. It’s not technically a sweep.

Well … there’s always a PlanB around: can you post here a R5 file with the thing?

Find Center line_r5.3dm (1.5 MB) (224.5 KB)


Another solution using a snippet of an @HS_Kim angle script.

Find Center (225.6 KB)


When posting a quick image, is there a trick to being able to zoom out while still keeping the full definition of the components? See on my image—I zoom out and all the text/icons disappear.

Well … if you have plans to enter the code bandwagon … finding the top face is just one line and then pairing the polyline points (for the ccx planes or the co-planar rest from the collection of vertices) is another 2. Way faster than classic clustering for vertices co-planarity.

1 Like

Thank You all experts. Problem solved.

Hi Peter, Can I get t above C# component. I tried to program with your attached image. But its showing error.

Well … that was not a complete C#: after the Cyclist attached the R5 file (and by inspecting the object of yours) I wrote a few lines (in fact one) in order to locate the top most face (that has an outLoop a Polyline). Since a components based solution was provided I recycled that small C# and never did the next step (i.e. creating the pairs of Polyline nodes for the sections and then the centroids and then the spine curve etc etc).

But even if a complete C# was available … what could be the usage for you? (I suspect that you are not in the code bandwagon, if else notify).

Also keep in mind that code based solutions are case specific.

1 Like

Hi Peter, I second the OP, could you provide the script of your first post for learning purposes? Thanks!

1 Like

You mean the one with the blue Brep eh? OK, I’ll attach the thing as soon as I can find it (Alzheimer and the likes). If not I’ll do it again

Hi Peter, I am using Rhino/grasshopper for my structural modelling in Tekla structures.( For using Tekla/grasshopper live link, I can add members rhino to tekla or tekla to Rhino.
Some times I need to extract center lines for Tekla elements in rhino (like previous image). So I am looking for easy methods.
Also I dont no what is “bandwagon”.

That is a term desrcibing a circus train (hence is used as a metaphor).

Anyway … as I said solving things via code is always case specific (so it’s a “narrow” minded solution - if you can’t play with the code, that is) meaning that you’ll receive a thing that is NOT a Jack for all trades

But in the name of science … provide some (R5 format) examples that could outline as best as possible the repertoire of your Tekla beams (for instance: are they all like the beam as above? are they planar? etc etc).

BTW: Tekla outputs always a faceted thing? (What if you need a curvy one?)

1 Like

Hi Peter, Thank you for your reply.
Here below you can download Some tekla object types in R5 format. I am always looking for this type profiles centerlines (curve only).

Well … you know what? I re-wrote the removed C# by adding the missing part (the upper polyline pairs etc etc) that is 20 times more complex than the single line captured (that locates the upper face) … and then the computer crashed (it happens occasionally for some mysterious reason [not C# related]), nothing is auto-saved (forgot to save the solution during the writing) and here we are: play it again Sam.

This case starts to brake my nerves I confess.

1 Like