With Blender 3.2.0 on Ubuntu 22.04 I am creating text using bpy.data.curves.new
, bpy.data.objects.new
and py.context.scene.collection.objects.link
/ bpy.context.collection.objects.link
(from https://blender.stackexchange.com/a/163680/33447).
Printing the object and its dimensions (bpy.data.objects[-1].dimensions
) property returns
<bpy_struct, Object("Font Object") at 0x7f62e023a608> <Vector (0.4050, 0.4670, 0.0000)>
(bpy.data.curves[-1].dimensions
also reports zero height)
whereas the Sidebar tells me 429,490,117 mm.
It also does not work with text created with
bpy.ops.object.text_add()
ob=bpy.context.object
ob.data.body = "my text"
However, it does work for manually created text (clear scene, add Text, extrude). Then run:
import bpy
# manual
last = bpy.data.objects[-1]
print(last)
print(last.dimensions)
font_curve = bpy.data.curves.new(type="FONT", name="Font Curve")
font_curve.body = "X"
font_obj = bpy.data.objects.new(name="Font Object", object_data=font_curve)
font_obj.data.extrude = 0.01
bpy.context.collection.objects.link(font_obj)
print(font_obj)
print(font_obj.dimensions)
bpy.ops.object.text_add()
ob=bpy.context.object
ob.data.body = "text"
ob.data.extrude = 0.01
print(ob)
print(ob.dimensions)
Output:
<bpy_struct, Object("Text") at 0x7f62e01f4a08>
<Vector (1.8980, 0.6910, 0.0200)>
<bpy_struct, Object("Font Object") at 0x7f62bfbca608>
<Vector (0.7040, 0.6820, 0.0000)>
<bpy_struct, Object("Text.001") at 0x7f62bfbcbe08>
<Vector (1.8980, 0.6910, 0.0000)>
What am I missing?