Uniting groups of families with polycurves

Hello EveryBody,
Hope you are all Fine.
I am making a code in dynamo where I want groups of families (for example 10 or 15, varying the amount) and join these groups of families with polycurves using points created with solid.centroid, so that the points closest to each other are joined. For this I relied on a previous forum.https://forum.dynamobim.com/t/closest-point-for-given-point-sorting-loop/12600/11?u=nfelipe.cardona.

So far I have the code like this:

And when running it for groups of 18 elements, you get the following:
image

The problem is that it is not grouping the closest points, as I need it. For example, taking as a reference the first group that is created, how can it be done that instead of joining the points like the previous image, they can be joined in this way (the red line being how I want it to group them):
image

Does anybody have an idea?

code_1.dyn (30.5 KB)

The revit file is too heavy to load.

Hi,

I had the same problem with my foundation brackets.
See my script how I have fix it.

I use a Spline (model curve) to sort the points.
Hopefully you can use it for you’re problem.

KG,

Jan Willem
2021 Prefab beugels.dyn (83.9 KB)

Thanks for answering, could you explain to me a bit how your script works, I’m a little new to dynamo :sweat_smile:

Yes ofcourse.
See below the script I have used:

SortAlongCurve.dyn (21.4 KB)

You need to draw a spline (key shortcut LI) and select spline
image

Select the elements to sort and select after that the spline. That’s all! :slight_smile:

By the way, in my first script I filter my specific elements that I need to sort, my advise is to do the same.