[C#] BoundingBox orientation question

Hi Guys,

im trying to reproduce with Rhino Common same behaviour as @DavidRutten made in GH component for bboxes as in this sample BBOX_VECTOR.gh (9.7 KB)

I wrote it as simple as i could:

        Rhino.DocObjects.ObjRef[] objarr;
        BoundingBox bBox = BoundingBox.Unset;

        Point3d center_point = new Point3d(0, 0, 0);
        Vector3d zaxis = new Vector3d(0, 0, 1);
        Plane plane = new Plane(center_point, zaxis);

        var rc = RhinoGet.GetMultipleObjects("Select Breps", false, ObjectType.Brep, out objarr);
        
        foreach (var obj in objarr)
        {
            var perbox = obj.Geometry().GetBoundingBox(plane);
            bBox.Union(perbox);
        }

        conduit.obtbox = bBox;

But if i change vector for plane it changes actually whole coordinate system - for eg when 0,0,-1 it gives mirror effect instead of direction change of drawing bbox. Somebody have a clue how to tackle this? :pray:

Hi @D-W,

When you pass a plane to GetBoundingBox, you are asking for the bounding box to be oriented to the plane. Thus the results are in the coordinate system of that plane. If you need the coordinates in the World XY plane, then you to transform the bounding box corners from plane coordinates to World coordinate using Transform.ChangeBasis.

This sample is worth reviewing.

– Dale

1 Like

Thank you very much @dale for a quick tip! I hope i’ll sovle this now :slight_smile: