Featured post

new redirect for blender.org bpy docs.

http://www.blender.org/api/blender_python_api_current/ As of 10/11 november 2015 we can now link to the current api docs and not be worr...

July 11, 2011

Text Object (bpy.data.texts) operations

with a textobject with text do

>>>bpy.data.texts[0].lines[0].body
...this is the first line of your text object
so if you want the lines between some selection

>>> [line.body for line in bpy.data.texts[0].lines[4:8]]
['line 5', 'line 6', 'line 7', 'line 8']

>>> selection = [line.body for line in bpy.data.texts[0].lines[4:8]]
>>> for line in selection: print(line)
...
line 5
line 6
line 7
line 8