For some reason, every time I try and so a solid difference of the circles and rectangles, the output does not work.

This is the grasshopper file:

# Help with subtracting circle multi-point attractor from rectangle

**rjohns**(Rjohns) #1

**Joseph_Oster**#2

That file is useless. Even if you had internalized your `Pt` params, there is no sign of “solid difference”? Being only 2D, maybe `Region Difference` is what you want instead?

**Joseph_Oster**#3

Here is a functional version of your code that doesn’t rely on external attractor points. Note that the number of curves (rectangles) from `RecGrid` is less than the number of points, which is also the number of circles…

multi_point_attractor_2018Feb9a.gh (13.0 KB)

**Michael_Pryor**(Michael Pryor) #5

and if you do want to use external points set them all in one point component > right click > set multiple. There is no need to copy paste so many.

**Joseph_Oster**#6

Is this what you have in mind?

multi_point_attractor_2018Feb9b.gh (13.8 KB)

Note that I reduced the `RecGrid` ‘Ex’ and ‘Ey’ values from ‘35 X 24’ to ‘8 X 6’. The larger values result in 756,000(!) `RDiff` operations (840 X 900) and I wasn’t patient enough to wait for that to finish. The ‘8 X 6’ grid results in only 3,024 operations (48 X 63), which still takes ~17 seconds of profiler time.

Always debug at low resolution! When you are sure it works, crank up the resolution and go to bed. If you’re lucky, it will complete overnight.

There might be ways to improve the algorithm, such as structuring the data tree so that `RDiff` operates only on the four circles at each corner of each rectangle (48 X 4) instead of checking ALL circles with each rectangle.

P.S. Then again, testing only the four circles at each rectangle’s corners will miss the effects when more attractor points are used and the circles can grow very large. So **tip #2**: disable the slow component (`RDiff`) and look at the pattern of overlapping circles before re-enabling it.

**Joseph_Oster**#7