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

    Adapt text position depending on the font style

    Scheduled Pinned Locked Moved PYTHON Development
    4 Posts 0 Posters 354 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 29/11/2016 at 18:47, xxxxxxxx wrote:

      Hello There,

      Is it possible to adapt text position depending on the font style used?

      Some fonts like the font presented in the image below, her default axis position not placed on the bottom extremity of the text.
      To beter understand see the example below:

      I want to automatically get the interval beteween P.1 and P.2 then I add this value to the Y postion of the spline text. To drop it on the floor.

      Thanks!

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

        On 30/11/2016 at 01:15, xxxxxxxx wrote:

        Don't tested but doing axis_Y - BoudingBox_Bottom should work.

        For getting the bottom of the bouding box simply do

        import c4d
          
        def main() :
            world_pos  = op.GetMg().off
            bBox_pos  = op.GetMp()
            bBox_size = op.GetRad()
            local_bottom = c4d.Vector(0,bBox_pos.y - bBox_size.y,0)
            world_bottom = local_bottom + world_pos
            print world_bottom
          
        if __name__=='__main__':
            main()
        
        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 30/11/2016 at 07:26, xxxxxxxx wrote:

          Originally posted by xxxxxxxx

          Don't tested but doing axis_Y - BoudingBox_Bottom should work.

          For getting the bottom of the bouding box simply do

          import c4d
           
          def main() :
              world_pos  = op.GetMg().off
              bBox_pos  = op.GetMp()
              bBox_size = op.GetRad()
              local_bottom = c4d.Vector(0,bBox_pos.y - bBox_size.y,0)
              world_bottom = local_bottom + world_pos
              print world_bottom
           
          if __name__=='__main__':
              main()
          

          Hi,

          Exactly what I want! !Thumbs Up[URL-REMOVED]  Thanks so much!


          [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.

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

            On 30/11/2016 at 10:29, xxxxxxxx wrote:

            Hi,

            just want to add, that GetMp() returns coordinates in local/object space, while GetRad() is actually in world space. So the above solution is probably only correct, if the object is in default orientation and a generic solution might need some additional matrix multiplication.

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