Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    c4d.utils.GetBBox() Returns Odd Results

    Scheduled Pinned Locked Moved PYTHON Development
    2 Posts 0 Posters 617 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • First post
          Last post