3D Text ob relocate

i created some 3D text OB

but how do we change the location in blender?

myTextValue = str3 # Text data that will be created

txt= Text3d.New(“Tangent”) # Name of the OB object
txt.setText(myTextValue)
txt.setExtrudeDepth(0.01)

Thanks

Feel free to browse my previous 3d Text code examples:
http://blenderartists.org/forum/showthread.php?t=131710&highlight=text+train
http://blenderartists.org/forum/showthread.php?t=117625

Here is something i just threw together and it works.


import Blender
from Blender import Text3d,Scene

str3 = "pickles"

myTextValue = str3 # Text data that will be created

txt= Text3d.New("Tangent") # Name of the OB object
txt.setText(myTextValue)
txt.setExtrudeDepth(0.01)


obj = Scene.getCurrent().objects.new(txt)


obj.LocX = 2

Blender.Redraw()

i tough that Text was a sort of object like a mesh

but you redefine a new object then relocate like an ordinary object

simpler then i tough i guess

but is there a way to do it directly form the Text object itself?

Thanks

Nope, a Font object is linked to an object. There is no LocX for the Font object.

i want to add to this 3D Text object a text + aconverted num to string value with a format

str1=“CoTangent = "
str2= str(”%.2f" %cot1l)
str3=str1+ str2
print ‘str3=’,str3

myTextValue = str3 # Text data that will be created

txt= Text3d.New(“Cotangent”) # Name of the OB object

here i;m trying to show the Text Tangent + the value of the Tangent as Text inside the 3D Text object with a format limited to 3 digits for instance

i tried like a print with format but always error on it !

how can this be done

Thanks

Just use setText dude.


txt.setText(str3)

but how do you include inside the command the format to limit the numbers of digits to let say 3 or 4 after the point

EX: Tan = 1.345 D

it’s the format instruction i’m having problem with

Thanks

You can always try and Google stuff that is non-Blender related that way you don’t have to wait.

http://diveintopython.org/native_data_types/formatting_strings.html

I typically just use STR.


myNumber  = 1.35
myString = "TAN = " + str(myNumber) + "D"

how to limit it inside the command directly

let say you ahve a calculated number
it comes iwth i think 7 digits
but if you ahve severals digit agfter the point like 1.4567834

you don’t want to show all the digits only 2 3 or 4 - it enough as precision

this can be done with the format like %.3f
Ex: print ’ st=’,str("%.2f" %angc)+ " D " this works fine

but is it possible to do this inside the 3D text command?

cause when i do this 3D text i don’t want to see 7 digits only 2 or 3

Thanks