Maximum distance between multiple elements


I have a lot of piles in my drawing, and I need to check if there aren’t piles whitin a maximum distance of each other. Till now I only have a list with the coordinates of the piles, but I don’t know how to get further…

Does anyone know how to get this done?

I would try something like this:

  1. Get all of the piles
  2. Get the location point of each pile and pull them into a common plane
  3. Get the radius of each pile
  4. Draw a circle at each point using the associated radius
  5. Offset each of the circles by the maximum distance and a very small value (1/8”)
  6. Build a surface of each small and maximum distance offset using a Surface.ByLoft tool, giving a bunch of donut looking surfaces which represent the clear space needed around each pile.
  7. Patch all of the original circles (step 4) using a Surface.ByPatch, and build a polysurface using a PolySurface.ByJoinedSurfaces node, resulting in a single surface showing the extents of each pile.
  8. Test each of the donut surfaces (step 6) for intersection with the PolySurfaces (step 7) using a Geometry.DoesIntersect node.
  9. Filter the list of piles (step 1) by the test results (step 8) using a List.FilterByBoolMask node. Anything in the ‘in’ output of that node is inside the clearance requirement.

Note: by converting to a polysurface in step 7 you only have one test to run for each pile, so N tests. If we left each pile as it’s own you would have to run N tests N times, so N^2 total tests, reducing runtime significantly.


Thanks for the reply! Unfortunately I’m struggling after the intersection node…
After using the DoesIntersect node (with lacing on Cross Product) I get the results as shown in the picture. I can see that the ones with more than one True response are intersecting. However, I can’t figure out how to filter those from the list (so that I can give the piles another color for example).
Do you know how?

You can assume every pile will have one intersection with itself, so, like you said, anything with two or more has an actual conflict. To filter those conflicting piles out you can just use CountTrue to count how many intersections each pile has, and then filter all items with a corresponding value of 2 or more.

If using the slight offset to build the donut shapes, this would not be the case - there should be three concentric circles per pile.

Cross product lacing also shouldn’t be needed - you may need to flatten the list before making the polysurface from the piles. One item should be inout to the second input of geometry.does intersect, and a list of ‘donut’ surfaces for the rest.

@n.fernandez4LX3D - Group your nodes, document what you are doing in each group, expand all data previews, zoom in so you can read one node well, and use the export canvas as image feature (top right of the Dynamo window) so we can see the entire graph. Do t worry about fitting all the nodes - the export functionality will capture them all. My gut says all you need to do is bring over the right list into the FilterByBoolMask node, but I can’t see enough to know.

1 Like

I’ve come a long way. The script does work.
The only problem I got is that the donut shapes aren’t corresponding right withpiles that have an angle.
I’m trying to find a way to localize the location of the endpoints of the piles, but I can’t figure out how to do that…

Here’s my script, and the donut shapes that are being made in my model.

1 Like

You’ll have to use a sweep or a loft to take into account both endpoints.

1 Like

I really have no idea how to get this done…

Take a look at these nodes and give them a shot. You just need the pile radius (or collision radius) and the endpoints of the pile. Everything else can be built off those values.

1 Like

Thanks! I managed to get it working.

1 Like

Great job!