c4d.utils.GetBBox() Returns Odd Results

On 22/03/2018 at 17:19, xxxxxxxx wrote:

According to the documentation, c4d.utils.GetBBox() should return the Center and Radius of the object hierarchy.

However, I'm getting unuseable results. To test:

1. Create a cube
2. Make it editable
3. Move the cube's axis to it's base
4. Add an Expression Tag to the Cube with this expression:

  
import c4d   
  
def main() :   
    obj = op.GetObject()   
    mp, rad = c4d.utils.GetBBox(obj, c4d.Matrix())   
    print "(mp: %s, rad: %s)" % (mp, rad)   

The output is:
(mp: Vector(0, -100, 0), rad: Vector(100, 100, 100))

Just because the axis has moved doesn't mean the global center point should move.

Expected:
(mp: Vector(0, 0, 0), rad: Vector(100, 100, 100))

Am I misunderstanding how to use this method? If not, any workarounds for making it usable?

On 25/03/2018 at 12:35, xxxxxxxx wrote:

Hi Donovan, thanks for writing us.

With reference to your question, in order to get the proper results I'd suggest to use:

  
def main() :  
  obj = op.GetObject()  
  mpTrf = c4d.Matrix()  
  mpTrf.off = obj.GetMp()  
  mp, rad = c4d.utils.GetBBox(obj, mpTrf)  
  print "(mp: %s, rad: %s)" % (mp, rad)  

By using this approach you're properly providing the method with a transformation matrix whose position is the correct one for the bounding box. Moreover it should be noted that passing a different transformation matrix which could might represent a different coordinate system you'd be able to obtain the bbox information in that coordinate system.

Hope it helps.

Best, Riccardo