When groups overlap

Is there a way to know when groups overlap, as shown in the picture, and how to know which parts of groups overlap?
And is there a way to get the width or volume of overlapped parts?

If you are still using a Make edition, then this part will not help you.

If you have a non-Pro edition it will be extremely difficult.

Pro Only: This has been discussed with regard to soil cut and fill calculations for construction sites.


And at SketchUcation:

The most basic test would be to see if the bounding boxes of the groups collide.

interference = grp1.bounds.intersect(grp2.bounds)
possible_collision = !interference.empty?

But often geometry is not completely rectilinear. In these cases the bounding boxes might intersect but the geometry might not.

To get more precise you’d likely need to use the Entities#intersect_with method and test the result to see if it resulted in any intersect edges. If this is destructive, you may need to create “clone” instances of the 2 groups to do the test upon.

Try searching this category for “intersect_with” for more discussion.

Thank you!

1 Like