Forgot password?

Create an account!

Forum

« back

RhinoScript – Check if Object is within a certain bounding box

Messages

Please log in to write a message.

  • 2. flattyre (Jan 30, 2012 16.49):

    Found it !
    The command Rhino.IsObjectInBox(strObject, arrBox, False) does the trick.

  • 1. flattyre (Jan 30, 2012 13.59):

    Hi all,

    I'wondering wether there is a smart function to check wether an object is within a certain boundingbox.

    At the moment i'm using this piece of code

    Dim arrBbPts
    arrBbPts = Rhino.BoundingBox(arrObjects)
    P00 = arrBbPts(0)
    P06 = arrBbPts(6)

    arrObjects = Rhino.AllObjects

    If IsArray(arrObjects) Then

            For Each strObject In arrObjects
                    arrObjectBbPts = Rhino.BoundingBox(strObject)
                    ObjectP00 = arrObjectBbPts(0)
                    ObjectP06 = arrObjectBbPts(6)
                    If (ObjectP00(0)>=P00(0) AND ObjectP00(1)>=P00(1) AND ObjectP00(2)>=P00(2) AND ObjectP06(0)<=P06(0) AND ObjectP06(1)<=P06(1) AND ObjectP06(2)<=P06(2) AND ObjectP00(2) <> P06(2)) Then
                            Rhino.SelectObject (strObject)
                    End If 
            Next
    End If

    Although it works, it takes too much time, when selecting a huge amount of objects.

    Is there a faster way ?

    Kind Regards
    Koen

Recommend

Why are these buttons gray?