A script to create characters and word groups in Blender

Hi.

This is a simple script wich takes a text and create a group of words in the text, ready to become particles, for example.


#---------------------------------------------------------- 
# File abc.py 
#---------------------------------------------------------- 
import bpy 
import math 
from math import pi 
 
def run(origin,text):     
    # Create and name TextCurve object 
    bpy.ops.object.text_add( 
    location=origin, 
    rotation=(pi/2,0,pi)) 
    ob = bpy.context.object 
    ob.name = "tcuText" 
    tcu = ob.data 
    tcu.name = 'tcuData' 
    # TextCurve attributes 
    tcu.body = text 
    tcu.font = bpy.data.fonts[0] 
    tcu.offset_x = 0 
    tcu.offset_y = 0 
    tcu.shear = 0 
    tcu.space_character = 1 
    tcu.size = 3 
    tcu.space_word = 0 
    # Inherited Curve attributes 
    tcu.extrude = 0 
    #tcu.back = Truea 
     
def abecedario(): 
    text=" a b c d e f g h i j k l m n o p q r s t u v w x y z " 
    text=text+text.swapcase()+" 0 1 2 3 4 5 6 7 8 9 El Ataque Hipostasiado" 
    text=text.split() 
    return text 
 
def hacergrupo(): 
    bpy.ops.object.select_all() 
    bpy.ops.object.select_all() 
    bpy.ops.object.group_add() 
    bpy.ops.group.objects_add_active() 
     
if __name__ == "__main__": 
    text=abecedario() 
    for i in text: 
        run((0,0,0),i) 
    hacergrupo() 
  

You can see in action here:

only problem with it is that it creates a group out of everything in the scene, including the camera and the lamps.

That’s true, it’s only a simple example. I use to create groups in empty layers.