can someone help me with a script diaplying a number on a cube ?

well i am making a street, (see focus critique) what would be really need i think.
If the houses had house numbering. But since i plan to build in block, to create streets later quickly.
I’d like the house numbering to go automatic.

So i imagine a cube called housenummber ; copy the cube and you get housenumber.001 next .002
If it could get those .001 and transfer it to text in 1 i would be cool.

I am not such a good scripter with blender so i dont know if what i ask is difficult or simple.

It is simpler to just create a single font object, type your number. Then duplicate it and change the numbers. By the time you write and debug the script the task could be done in the interface. If you had to do this everyday, then maybe a script is in order.

Have fun making art, not scripting.

given that all of your text objects match the pattern name.number and are member of a group named ‘Group’ you may do something like this


group=bpy.data.groups['Group']

for txt in group.objects:
    txt.data.body=obj.name.split('.')[1].lstrip('0')

(add your text object to the group before you copy it or select a text object and press shift+g ->Type and ctrl+g afterwards to add them to a new group if there aren’t any other text objects except housenumbers in your scene)