# How to "trim down" objects scattered on top of each other

I have a problem:
I’d like to create an efficient definition, that I can use to create 2D patterns of following kind:

So, the idea is to have circles (or other closed curves) in a grid, and have them trim each other in a way that makes them seem like overlapping each other. Or, like if you have surfaces (or surfaces with curves) scattered on top of each other in Rhino, and have a top view of it. I’d want exactly what you see in the top view, but so that everything that is behind another surface, is trimmed away in an efficient way.

I have managed to get right kind of results, but with too much computing, with a definition like this:

1. Create 2D grid.
2. Move the points in increasing increments in Z-axis, so that the next point is a bit higher. (Or in any order as long as every point is in it’s own, unique height.)
3. Make the curves, or surfaces, in these points:

1. Make corresponding, high enough cylinders in these same points
2. Trim the curves / surfaces with the cylinders using “Trim with Breps”
3. Project the resulting curves / surfaces to the world XY-plane.

The definition works fine, is intuitive to use and gives right kind of results… but is extremely slow / crashes in bigger grids.

I figure there must be very a lightweight way of doing this, but I just can’t get my way to it. I have tried to, for example:

1. Create 2D grid
2. Make the circles (with offsets) in the grid.
3. Check with “Proximity 2D” component which points are close to the one having the object to be trimmed…
…etc. but I don’t understand well enough the data trees etc. to be able to pick the right circles to trim with etc. I have tried, but it just escapes me.

I figure that to keep the tool intuitive, it could be useful to keep the Z-axis as part of the game, meaning scattering the objects (lines, surfaces…) along Z-axis in their grid points. But how to get them, how would I say… “trim down” each other, if you get what I mean? And should there be the “Proximity 2D” component used somehow in order to not to have soon-too-vast “every object is checked against every other object” for intersections?

Any help would be greatly appreciated!

P.S. My “working” definition had severe limitations, and I managed to break it too, so it’s not much of a help for anyone. I’ll just attach the basic grid and really a stump of a definition, which will reduce some work, if anyone wants to take a look on this. It has everything else, except the logic, how to “trim down”.

Circles_scattered_around.gh (25.3 KB)

You didn’t internalize your curves. If it’s just a rectangle, why not use a component instead?

That’s a very long description considering that your objective was clear in the second paragraph.

1 Like

Fixed that!

One easy option would be to use Make2D

make2dcircles.gh (6.6 KB)
It’s still probably too slow to be practical for tens of thousands of objects, but I think much faster than doing booleans

4 Likes

Still useless without PTComponentLibrary, which doesn’t seem necessary.

Sooo… that kind of a component exists, right

You don’t believe how long I have battled with this. Thanks a lot!

1 Like

Hmh, I had to unmark this problem as solved.

Make2D works great with curves, but if I would like to have surfaces, it doesn’t do that. And there is no easy way to make surfaces from curves produced with Make2D. Because lofting the curves would produce straight edges in places that were actually trimmed with non -linear curves.

EDIT:

One avenue could be projecting the trimming curves to the surfaces from above the surfaces, but not below, and trim with them. But I don’t know how to do this. Project along a vector doesn’t seem to differentiate between +Z and -Z, for example. How do I choose only the curves that are above an surface and project them?