2.5 how to add Text ?

is saw this command for format but not how to add text and control like the resol extrude ect…

bpy.types.TextCharacterFormat

any example would be usefull

or may be easier tiwht bpy.ops?

Thanks

expecting this will help > bpy.ops.object.text_add()

ok but hen how do you pass the text and change the resol and get some extrude
then how to convert to mesh data!

Thanks

i saw theses commands in report console

bpy.ops.font.text_insert(text=“Rickyblender”)

bpy.ops.font.text_insert(text=“s”)
bpy.ops.font.delete(type=‘PREVIOUS_OR_SELECTION’)

but is there a better and faster way way to add some text to a font object ?
also a better like to clear all text inside a font object
and add a whole word to a font ?

any help appreciated

Thanks

import bpy

# Create TextCurve object
bpy.ops.object.text_add()
ob = bpy.context.object
tcu = ob.data
print(ob, tcu)

# TextCurve attributes
tcu.body = "Hello, world"
tcu.font = bpy.data.fonts[0]
print("Font", tcu.font)
tcu.offset_x = 0.1
tcu.offset_y = -0.25
tcu.shear = 0.5
tcu.spacing = 2
tcu.ul_height = 0.7
tcu.ul_position = -1
tcu.word_spacing = 4

# Inherited Curve attributes
tcu.extrude = 0.2
tcu.back = True

thamsk a lot

i would have never guess how this was done in 2.5 !

happy 2.5

i tried it with a specific word and works nicely

now is this Text thing a new type in blender?
cause there is also Font type so not certain here if we have a new type in 2.5 ?

only things missing are theses

how do you set for instance

the color ?
or is it done through the OB object or the Text object ?

and if i have let say a real number generated in a loop and want to transform it as text formatted to show for instance a certain number of digits after the dot like

i start with a number like num1=25.000001454
and want to get a string1 = 25.00
i can convert with str (nuim1) but then how is the format applied to this string?

i can format a number for a print like this

var1=25.01256
print (“Var1 = %.3f” %var1)

giving 24.013
but how to pass this to a string then use this srting to add Text ?

i found this way with rnd

var2=round(var1, 2)
print (‘var2=’,var2)

but is this the best way to do it in python ?

$$$$$$$$$$$$

i found the page for this

http://www.blender.org/documentation/250PythonDoc/bpy.ops.object.html?highlight=bpy.ops.object.text#bpy.ops.object.text_add

it looks like there is a location to specify as parameter

but how to use this command and specify the location and how ?

Thanks & happy 2.5