BoundingBox.Transform not work

BoundingBox.Transform not change internal data, while transform.TransformBoundingBox work well.

boundingBox = transform.TransformBoundingBox(boundingBox);
bool result = boundingBox.Transform(transform);

Rhino version: 7 SR13 (7.13.21348.13001, 2021-12-14)
Nuget “RhinoCommon” version:7.13.21348.13001

@dale , Would you please have a look at this?

Hi @RyanZhou,

This seems to work as expected:

import Rhino

min = Rhino.Geometry.Point3d.Origin
max = Rhino.Geometry.Point3d(5, 5, 5)

bbox = Rhino.Geometry.BoundingBox(min, max)
print(bbox)

xform = Rhino.Geometry.Transform.Scale(min, 5)
bbox.Transform(xform)
print(bbox)

What am I missing?

Thanks,

– Dale

Dale, thanks for your reply. After checking code, I find that I make a mistake and there is no problem with api. Sorry for that.

BoundingBox is struct, instance’s property return a copy of it, anything changed will not affect origin value, below is demo code.

class XXXClass
{
    BoundingBox BoundingBox { get; set; }
    
    void XXXFun(Transform transform)
    {
        BoundingBox.Transform(transform);
    }
}

Hi @dale, can you explain why attached does not work? I’m trying to get the BoundingBox in active CPlane orientation. The xform seems valid as it works for the box corners, but not for the BoundingBox:

bbox_cplane.3dm (231.2 KB)
bbox_cplane.py (1.1 KB)

thanks,
c.

Hi @clement,

It doesn’t do much good to transform a BoundingBox, at it’s just two (min, max) points.

Better to transform the corners.

bbox_cplane.py (1.4 KB)

– Dale

Thanks @dale. I have no idea why Translation transform works but ChangeBasis not.

_
c.