Get the object for a curve

Hello everyone,

I am creating automated rendering in blender using external data that is being processed using python.
In this case I am building a table based on comma separated text.

This is my setup: I create one row, a cube, with textcurves parented to it.
For every textline in data, the row is being copied and moved downwards and the textcurves would be filled in according to the data.

Question is:
How can I find the textcurve that is associated with it’s own object by looping through the children of the parent row?
I know that a textcurve can be accessed by calling e.g. bpy.data.curves[‘text.001’] and it’s object bpy.data.objects[‘text.001’] but I havent found a way of ensuring/controlling the names match.

This is essential for me because the object contains and handles the locations and scaling of the textcurves.
Whereas the textcurve body has to be replaced.

Maybe I am looking at it the wrong way but searching through the documentation I haven’t found a property on either the curve or the object where I can access them. Something in the lines of bpy.data.objects[‘textObject’].curve.body.
I am not seeing how the 2 are linked!

Any thoughts on this?

Thanks in advance!

Sander from Holland

I feel a bit stupid because the answer was really simple, but I will add answer for other scripters!

Eventually I have found the link where the data property of the object is the TextCurve
So bpy.data.objects[‘textObject’].data.body is what I was searching for :yes:

This is how I search the objects or textcurves

Find TextCurve by Object name “title”:


textcurve = bpy.data.objects["title"].data

Find Object by TextCurve name “title”:


objects = [obj for obj in bpy.data.objects if obj.data.name == "title" ]
if objects:
    object = objects[0]

:smiley: