Using python script to show another object's location value

Basically, I want to show the height of another object in a font object. It’s somewhat similar to have the content of a font object (text) “driven” by another object’s ipo curve.

I guess it’s not possible to do this simply by driven Ipo, as the content of a font object cannot be “driven”, as far as I know.

Is there a simple python script that I can use to continuously update the content of a font object based on the parameter of another object, say, X position?

Many many thanks.

SF

I don’t know of one, but it should be relatively simple to do… at least to bake anyway, I don’t know about view handlers and real-time.

what do you need it for? detailed explanations help.

Hi. python command is :

import Blender
xposition = 10
Blender.Text3d.Get(“Text”).setText(str(xposition))

…in this example, the 3d text is “Text”, while the text object is called Font. these 2 names are in editing buttons(F9)

problem seems that you need to go into edit mode, then leave edit mode to update the text object, so it may not be able to update continuously.

to get x postion of an object, the code is:

xposition = Blender.Object.Get(“Cube”).getLocation()[0]

change [0] to [1] or [2] to get y and z location, or leave it out to get them all.

If you can get it to update automatically, the script is normally run by enabling script links, and adding the script. you then select FrameChanged to make it update all the time.