Group points by proximity

Hi all,

I am looking to group points with the following rules.

  • if the distance is between the points is == to .5 to .6
  • group the points to a maximum of 3 points per group.
  • then find the average point between them.

I used the proximity 3d and proximity 2d but haven’t been able to rule out points that are too close. And have been looking for options on c# or python but I am still fairly new to scripting so its taking me a bit longer than excepted.
If you happen to know of a good example I can follow or a quick script that can get me started I would really appreciate it.


This script should do what you ask for.
However the dimensions you give feel very circumstantial, what exactly are you looking for with these average points ?

Edit : forgot about the max. 3 pts/branch, but you could Prune and/or Partition List the outTree. (6.6 KB)

1 Like

Hi, and thanks for the quick response!

They are, but this script works like a charm. only a couple of instances where the rules could be revised to group the closest point of the two similar to the snap below but I feel I can find a way to get that.

the average points are meant to give me a center line of the overall network.
I got the revit model as a mass and with rhinoinside managed to get the vertices. with the center lines I will bring them into etabs or sap for analysis.

Well … I would suggest a classic Flat Hard Clustering approach for that sort of stuff. All that prior using RTrees and the likes (but only if there’s lot’s of pts around). (126.0 KB)

1 Like

If what you actually want is the skeleton of that shape, just grouping points by proximity isn’t the best approach - look instead for posts about the medial axis. @laurent_delrieu has posted various tools and scripts for this.

1 Like

Given the opportunity … In fact … I have a “bridge poly sides” C# that almost does what is required (but it needs some lines more for the general case).