Grasshopper

algorithmic modeling for Rhino

# Does object fit into box?

Hello,

I have big amount of polysurfaces. I only need to know, which of them fit into box of desierd dimensions (2.5x2.5x12m)  and which do not. Is there a way to do this, please?

I tried to do it with "smallest bounding box" scripts, which I found here, but it does not solve my problem.

Thanks

Views: 1380

### Replies to This Discussion

Why didn't the smallest bounding box method work?

Can you supply some sample polysurfaces?

It did not work, because the smallest bounding box returns a box with smallest possible length for every dimension of the box I assume. The polysurfaces/meshes are narrow and long and the script puts them in the box diagonally, if you understand.

Not knowing the nuances of your geometry this is about as much of a guess as I can provide. Since you have objects with a high aspect ratio you just need to come up with a way to generate a vector that describes the orientation of the bounding box.  In the case of these cylinders I'm using the normal vector at the ends.

Can you draw us a picture?

--

David Rutten

david@mcneel.com

Tirol, Austria

Here is the picture - it is just a sample of the mesh. I need to check, whether the green parts fit the box (2.5x2.5x12) or not. So far I checked it with help of bounding box in Rhino (see the box in picutre), but for every part I had to find the right CPlane - this is the tedious and boring part.

Thanks

But if the Minimum BoundingBox of the object is smaller than 2.5x2.5x12, you have your answer right? So the problem here is that the minimum bounding box exceeds those limits yet it is possible to find a 2.5x2.5x12 box that contains the shape?

--

David Rutten

david@mcneel.com

Tirol, Austria

Yes. Because the minimum bounding box script sometimes returns a box with one dimension very small, but the other exceeds 2.5m. The volume is smallest, but this is not what I want.

Finally, after a few tries, this is my workaround, maybe too difficult but it seems to be working. Take a look, anyone :-)

For short introduction: I found ideal plane for bounding box. Then I rotated it in series of -45 to 45° and created a bounding box for all of these angles. Then I filtered solutions with both x,y dimensions shorter than 2.5m and that's it.

I also attached the script.

Attachments:

by jodyc111

• View All