Get centre of the Text Spline object [SOLVED]
On 23/12/2014 at 15:14, xxxxxxxx wrote:
What would be the best way to get Text Spline (with some text in it) centre point coordinates?
I am a little bit rusty with Python, please excuse me if it's a simple question.
On 23/12/2014 at 17:27, xxxxxxxx wrote:
This code in a Python Expression tag w/ a link field in the UserData works for me:
"""Spline Center Expression Tag Moves object to the center of the spline""" import c4d #Welcome to the world of Python def main() : #Get the spline spline = op[c4d.ID_USERDATA,2] if spline is None: return #Retrieve the center of the bounding box spline_center = spline.GetMp() #Move object this Expression Tag is on to the center of #the bounding box obj = op.GetObject() obj.SetRelPos(spline_center)
This is all calculated in Local coordinates, I'm not sure how that would change for Global coordinates.
On 24/12/2014 at 06:25, xxxxxxxx wrote:
Oh yes, that's right, it's GetMp() I was looking for. Thanks Dinovan, I have to dust off my skils at reading sdk.