Adapt text position depending on the font style



  • 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!



  • 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()
    


  • 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  Thanks so much!



  • 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.


Log in to reply