IsObjectInBox

Verifies an object's bounding box is inside of another bounding box.

Syntax

rhinoscriptsyntax.IsObjectInBox(object_id, box, test_mode=True)

rhinoscript.object.IsObjectInBox(object_id, box, test_mode=True)

Parameters

object_id

Required.  String or Guid.  The identifier of an object.

box

Required.  List of Points or BoundingBox.  The bounding box to test against. A bounding box is an array of eight 3-D points that define the corners of the box.  Points need to be  in counter-clockwise order starting with the bottom rectangle of the box.

test_mode

Optional.  Boolean.  The test mode.

Value

Description

True (Default)

The object's bounding box must be contained by the test bounding box. In other words, test.min <= object.min and object.max <= test.max.

False

The object's bounding box must be contained by or intersect with the test bounding box.

Returns

True

The object is inside of box

False

The object is not inside of box

Example

import rhinoscriptsyntax as rs

box = rs.GetBox()

if box:

    rs.EnableRedraw(False)

    object_list = rs.AllObjects()

    for obj in object_list:

        if rs.IsObjectInBox(obj, box, False):

            rs.SelectObject( obj )

    rs.EnableRedraw( True )

Also See

BoundingBox

GetBox