Grouping surfaces by distance

Hello Everyone, so ive managed to create bunch of surfaces, its looks like this

As you can see, theres a bunch of rectangles and some of them is placed too close each other, even theres overlapping ones…

what im trying to do, is grouping them by tolerated distances. and get the perimeter surfaces of the grouped surfaces

heres examples


what im tryng to get is the red lines.

what should i do here?

Thanks in Advance!

Not sure if this will work, but worth a shot.

Pull the perimeter curves of each surface and create a polycurve thereof. Offset the PolyCurve by half of the separation distance. Patch them and union into a single surface with a Surface.ByUnion node. The result should be a polysurface.

Next extract the perimeter curves of that surface, and join the curves into polycurves. Then patch those polycurves into surfaces. You should have a surface for each ‘grouping’.

For each patched surface get the intersecting surfaces from the original set (Geometry.DoesIntersect into a List.FilterByBoolMask node to filter the original surfaces).

Now take the bounding box by minimum volume for each group of surfaces.

3 Likes

Hi Najwan,

I think I have the solution for the second half of your question (Generating the boundary around your merged geometries), my approach is to extract the list of all points in the boundary of each geometry, then merge it with all points of the boundary of the second geometry.

Now that you have a combined list of all points of these two geometries, you can extract the X coordinates in a separate list (Point.X node) and the Y coordinates (Point.Y node) in another list.

Once that done, extract the maximum value from the first list and the minimum value (Xmax, Xmin), do the same for the list that has the Y coordinates to extract (Ymax, Ymin)

Then, create four points using these coordinates, it should be like this:
Point 1: (Xmax, Ymax)
Point 2: (Xmin, Ymax)
Point 3: (Xmin, Ymin)
Point 4: (Xmax, Ymin)

Create a polyline using these points (Polyline.ByPoints) and do not forget to close the polyline by adding a fifth point that has the same coordinates as the first point. (when creating a polyline from points, the order of points is important, either clockwise or counterclockwise)

I hope this helps.