# Checking if objects are contained within

**URL:** <https://forums.sketchup.com/t/checking-if-objects-are-contained-within/121281>\
**Category:** Ruby API\
**Created:** [April 8, 2020, 6:02am UTC](https://forums.sketchup.com/t/checking-if-objects-are-contained-within/121281 "2020-04-08T06:02:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mamjankowski](https://avatars.discourse-cdn.com/v4/letter/m/c37758/32.png) [@mamjankowski](https://forums.sketchup.com/u/mamjankowski)\
**Post date:** [April 8, 2020, 6:02am UTC](https://forums.sketchup.com/t/checking-if-objects-are-contained-within/121281/1 "2020-04-08T06:02:14Z")

</div>

Hi,  
I have two figures: a cylinder and a cube with a hole. How to check if both objects have any common part using Sketchup API?

 ![test](https://global.discourse-cdn.com/sketchup/original/3X/9/b/9b16a87756a19051d319b171ef0dadd529213983.jpeg)

---

<div class="post-metadata">

**Author:** ![ecati](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/ecati/32/28643_2.png) [@ecati](https://forums.sketchup.com/u/ecati)\
**Post date:** [April 8, 2020, 9:56am UTC](https://forums.sketchup.com/t/checking-if-objects-are-contained-within/121281/2 "2020-04-08T09:56:28Z")

</div>

What exactly did you mean? Can you explain?

---

<div class="post-metadata">

**Author:** ![mamjankowski](https://avatars.discourse-cdn.com/v4/letter/m/c37758/32.png) [@mamjankowski](https://forums.sketchup.com/u/mamjankowski)\
**Post date:** [April 8, 2020, 10:18am UTC](https://forums.sketchup.com/t/checking-if-objects-are-contained-within/121281/3 "2020-04-08T10:18:28Z")

</div>

I have to check that two groups have collision (common part) with each other I think in my case, using bounds, I won’t receive this information.  
And I think, bounds does not work in Ruby Api properly. I have to try, sameting diferent … But I do not know what…☹  
br

---

<div class="post-metadata">

**Author:** ![McGordon](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@McGordon](https://forums.sketchup.com/u/McGordon)\
**Post date:** [April 8, 2020, 10:32am UTC](https://forums.sketchup.com/t/checking-if-objects-are-contained-within/121281/4 "2020-04-08T10:32:19Z")

</div>

Please don’t double post. I moved this to Ruby API.

If there were both manifold solids, you could maybe use Sketchup::Group#intersect.

---

<div class="post-metadata">

**Author:** ![kengey](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/kengey/32/234545_2.png) [@kengey](https://forums.sketchup.com/u/kengey)\
**Post date:** [April 8, 2020, 11:35am UTC](https://forums.sketchup.com/t/checking-if-objects-are-contained-within/121281/5 "2020-04-08T11:35:53Z")

</div>

Or, if they are not manifold:

1. check if the bounds intersect
2. check if their entities intersect

> **[Class: Sketchup::Entities](https://ruby.sketchup.com/Sketchup/Entities.html#intersect_with-instance_method)**
>
> The Sketchup::Entities class is a collection of Entity objects, either in a Sketchup::ComponentDefinition or directly in the Sketchup::Model.
