Bounding box points

Hi again to all!
If I create a planar trimmed surface the 8 points of the rs.BoundingBox(surfaceID) method should not collapse to 4?
Because if I try an rs.PointCompare it didn’t find the points with the same coordinates!
Here are a picture with the values.
Thanks!

Points.png

The point coordinates are equivalent within tolerance, correct?

I think they are in the absolute world tolerance. I let the default tolerance.

rs.BoundingBox is always going to return the 8 corner points of an object, even if the bounding box is degenerate.

http://4.rhino3d.com/5/ironpython/functions/boundingbox.htm

Is this your question or problem?

Hi Dale, excuse me for the thread hijack.
I often use Rhinoscript BoundingBox to find only the first 4 points on the CPlane, for example working with planar 2D geometry. Is this good practice or is there a more elegant way to find a BoundingRectangle.

@sam Hi Sam, this is the second time I replied to this post, the first one hung when I pressed reply, seems like it timed out or something.

Not Dale, but that is what I always do. I think all the GetBoundingBox methods return 8 points, even with planar geometry parallel to the box plane.

–Mitch

I’m fine with the 8 poits, I can filter them. But how can I fix the problem with the precision of the coordinates? The tolerance is 0,001 and i have more decomal if i print the points coordinates value. I need a loop to truncate it? Is there a method for that? I search in the scrpt editor help, but i didn’t find anything.

Just use the python round function. You cannot round a 3dpoint directly, you will need to round its individual coordinates. If you are just printing them, you can do this at print time, otherwise I guess you could write a little function to actually round the point coordinates themselves.

You may also need to import scriptcontext as rs.UnitDistanceDisplayPrecision has not been implemented yet.

–Mitch

import rhinoscriptsyntax as rs
import scriptcontext

p=scriptcontext.doc.DistanceDisplayPrecision
bb=rs.BoundingBox(obj)
for i in range(4):
    print 'Corner {0}: {1},{2},{3}'.format(i, round(bb[i].X,p), round(bb[i].Y,p), round(bb[i].Z,p))

A great way to handle this without hijacking the thread is to click the “reply as new topic” link to the right of each post. A cross reference will be created between both topics, and each can continue in their own direction. As an admin, I can take your posts and any replies and make a new topic, but so far I have found that doing that is more disorienting than helpful.

It wasn’t too bad a hijack in this case and Mitch settled the query nicely and on-topic.
Steve ‘replied as a topic’ to a post of mine a few days ago and I can see the benefit with the cross-reference link to the original thread in the new thread. Feel free to admin any of my posts, Brian, you won’t get into trouble…