this post was submitted on 08 Oct 2025
1 points (100.0% liked)

Blender

980 readers
14 users here now

Community to share art made in Blender. https://www.blender.org/

founded 5 years ago
MODERATORS
 

After inspecting the Info editor and little digging in Blender's Python API, I did the following

import bpy

lines = []
reading = True

while reading:
    try:
        lines.append(input())
    except EOFError:
        reading = False

# delete everything 
bpy.ops.object.select_all(action="SELECT")
bpy.ops.object.delete(confirm=False)

# add Text object, change to edit mode and set the string body
bpy.ops.object.text_add(align="VIEW", enter_editmode=True)
bpy.context.object.data.body = '\n'.join(lines)
print('\n'.join(lines) # for debugging
bpy.ops.object.mode_set(mode = 'OBJECT')

and I run the script by executing

echo -e 'hello\nworld\nI\nlike\nblender ' | blender -P ./script.py

the console output is as expected but the object data string is Text

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here