how to get data position and pint out?



  • On 26/03/2015 at 01:57, xxxxxxxx wrote:

    Hello,

    Showing the position in degree doesn't make sense. Do you mean the rotation? You can get the rotation vector from the matrix using MatrixToHPB(). The result is a rotation in radians, so you would have to convert the values to degree yourself with Deg().

    The Cinema 4D Python API does not provide any specific functions to write files. But of course you can use the standard Python libraries to access files.

    best wishes,
    Sebastian



  • On 27/03/2015 at 00:14, xxxxxxxx wrote:

    i have tried use MatrixToHPB but it doesnt work. and then i tried VectorToHPB and it works. but the third coloumn always "0". How come? this is my code
    import c4d
    #Welcome to the world of Python

    def main() :
      pass  #put in your code here
     
      a = op.GetObject().GetMg().off
      b = c4d.utils.MatrixToHPB(a)
      print a
    Inline image 1

    Inline image 2
    and how to convert values to deg?



  • On 27/03/2015 at 00:22, xxxxxxxx wrote:

    def main() :
      pass  #put in your code here
     
      a = op.GetObject().GetMg().off
      b = c4d.utils.VectorToHPB(a)
      print b



  • On 27/03/2015 at 00:28, xxxxxxxx wrote:

    Vector(3.144, 0.239, 0)
    Vector(3.144, 0.256, 0)
    Vector(3.144, 0.273, 0)
    Vector(3.145, 0.29, 0)
    Vector(3.145, 0.306, 0)
    Vector(3.145, 0.322, 0)
    Vector(3.145, 0.336, 0)
    Vector(3.146, 0.35, 0)
    Vector(3.146, 0.361, 0)
    Vector(3.147, 0.371, 0)
    Vector(3.147, 0.379, 0)
    Vector(3.147, 0.385, 0)
    Vector(3.148, 0.39, 0)
    Vector(3.148, 0.394, 0)
    Vector(3.148, 0.396, 0)
    Vector(3.148, 0.397, 0)
    Vector(3.148, 0.397, 0)
    Vector(3.148, 0.395, 0)
    Vector(3.148, 0.393, 0)
    Vector(3.148, 0.389, 0)
    Vector(3.148, 0.385, 0)



  • On 27/03/2015 at 01:52, xxxxxxxx wrote:

    Hello,

    as the name suggests MatrixToHPB() must be used with a Matrix, not with the translation vector as in your code. And as said before, turning the position into a rotation using VectorToHPB() does not seem to make sense. As you can read in the documentation, VectorToHPB() will always return a rotation with bank set to zero.

    best wishes,
    Sebastian



  • On 27/03/2015 at 02:00, xxxxxxxx wrote:

    Hello,

    the first case:
    you´ll need to feed the matrix not the offset vector from this matrix

    a = op.GetObject().GetMg()
    b = c4d.utils.MatrixToHPB(a)

    the second case:
    euler angle always gives you a zero banking back it calculates the direction with a fixed rotation around this direction

    a = op.GetObject().GetMg().off
    b = c4d.utils.VectorToHPB(a)

    for a complex track you might think about flipping conditions or quaternions.

    rad to degree:c4d.utils.Deg( r )
    or
    rad = HPB * math.pi / 180

    Hope this helps?
    Best wishes
    Martin



  • On 02/04/2015 at 07:17, xxxxxxxx wrote:

    Hello Yefta

    was your question answered?

    best wishes,
    Sebastian



  • On 05/04/2015 at 23:02, xxxxxxxx wrote:

    hello Martin.

    yes, it helps. but i still cant transform to degree. it shows "a float is required".

    can u help me out?



  • On 05/04/2015 at 23:14, xxxxxxxx wrote:

    hello s_bach

    i'm sorry, been off for a while. yes it's answered, but not all.

    if i type  c4d.utils.Deg(b)
    it shows in console "TypeError : a float is required"



  • On 06/04/2015 at 04:21, xxxxxxxx wrote:

    Hello Yefta,

    sorry my answer was a little sloppy.
    This should answer your question ...

      
      rad = c4d.Vector(0,1,1)  
      deg = c4d.Vector(c4d.utils.Deg(rad.x),c4d.utils.Deg(rad.y),c4d.utils.Deg(rad.z))  
      print deg  
        
      deg2 =  180/math.pi*rad  
      print deg2  
    

    Best wishes
    Martin



  • On 16/04/2015 at 00:35, xxxxxxxx wrote:

    thanks martin. :D


Log in to reply