How to Determine Centreline of a Pipe from Point Cloud

Is it possible to determine the centreline of a pipe for example from imported point cloud data within Revit?

I have been playing with the Sastrugi nodes, which in certain circumstances are great, however, if l have the following scenario, the best fit is not the centreline of the pipe.


Here is the result via Sastrugi…

Hi @Gcf_Design
Some options for you to try :wink:

For when you have a long enough section of pipe scanned…

  1. Utilising a sectionbox to extract cloud points for a length of pipe (ratio of perhaps, 1:5 (1=dia,5xdia of length))

  2. Getting a best fit line for the points extracted.

  3. Finding the average distance of the points to the new line.

  4. Use the dimension as a radius for sweeping a circular profile along the new line.

For incomplete data for a short section of pipe…
(as shown in the picture above)

  1. Use the section box to create a ‘sliver’ of the pipe points.

  2. Use the Arc.ByBestFitThroughPoints node on the small data set.

  3. Get the center point of the arc.

  4. Calculate the average distance from the points to the Arc center point.

  5. Obtain the normal from the best fit plane from the Point Selection node.

  6. Create a new Plane using the Normal and center point.

  7. Use the offset dimension to create a Circle.ByPlaneAndRadius on the newly created plane.

  8. Use this circle and the plane normal to generate your pipe.

I would have loved to run an actual example (as I have tested similar workflows on incomplete data) but I am not back at the PC till Monday :computer: :neutral_face:



Many kind thanks for your suggestions and time in replying to my question / query.

I shall look at your suggestions.

I shall update accordingly.



1 Like


I was looking at your second suggestions first, however, when trying trying yo extract the Vector components from the resultant arc, it presents an error…

I am failing to understand why this would be the case.

The output is an Arc not a Vector, so you cannot extract the values the Vector.X Y and Z nodes are expecting.

Try this (Dynamo - Sketch Edition) :smile:



Many thanks!

Ideally l would love the Sastrugi node to allow for a start ans end input, therefore have 2 centre points to determine the vector of the pipe. However, l am certainly not that clever to do that. I have looked at the node and even tried to double up the nodes at the beginning, however, this didn’t work (nor did l think it would).

I have added a message box to advise the user (me), what the prevailing diameter shall be.

Thanks for the suggestion, perhaps I could include a small suite of shape recognition nodes with my next release :thinking: it would be a nice little challenge :+1:

Can you post a pic of what the result of the workflow above looked like? Perhaps then I can offer some more suggestions that may get your pipe running in the right direction. :slightly_smiling_face:

Like having the user pick two sections of the pipe, to get your start and end points? (Two Sastrugi PickPoint nodes :wink:)


2 pick points about a pipe run within a point cloud or 2 selections would be great.

I tried a couple of tweaks to your dyf, however, my Dynamo skills are limited.


Another challenge l frequently come across is steelwork detection and subsequent modelling via point cloud data.

I used the pipe workflow to generate an equal placement. It worked, to a point :wink:


I tried doubling up your node, no joy.

I tried saving your node under a different name, then bringing both nodes in to act as a start and end pipe selection, but no joy. :frowning_face:

It sounds like you need some further direction with this. It will be another day but I will post an example workflow on Monday for pipe geometry creation. :slightly_smiling_face:


I hate asking for assistance and spend many hours trying to solve such problems. Sometimes l succeed, many times l do not. Programming is complex for me, yet l wish it wasn’t.

Dynamo is so fickle, it is repeatedly closing down now each time l am trying to open the script which l showed you a screenshot of. Ridiculous!

Meaning l cannot gain access to the script l have created to date.

That’s not good. :open_mouth:

I am guessing you have you tried the following:

  1. Restart Revit, and therefore Dynamo.
  2. Use the Open in Manual Mode toggle when opening the file.
  3. Checked you haven’t saved the 1.3 version graph in 2.0 format by mistake. (open the dyn as a txt file and look at the formatting)
  4. Check for backups of the graph in the Dynamo folder in your user data.
  5. Temporarily unloaded the pointcloud before opening Dynamo, just in case some weird binding is going on.

Can you start a new Dynamo graph alright? Is this behaviour specific to the graph you have been preparing, or does it happen for a previously created graph as well? (Backup any other dyn file before testing, in case there is some kind of corruption going on)

I hope some of that helps and you can get it running. I can sympathise as I have lost entire workflows from file corruption (from how our server runs) in the past…

Hi Ewan,

I have re-created it and tried again the double up of your node:

It works on occasion. Most of the time no points are selected as per image. Bloomin’ Dynamo. :wink:

The script recreated had been working fine upon a given location of point cloud and now returns nothing. Dynamo is so fickle which renders it unreliable most of the time.


Sadly l shall stop.

One minute it works, next it doesn’t, then if it works if returns a completely incorrect diameter pipe etc. ahhhh


90% of my best stuff starts in this version of ‘Dynamo’

1 Like