[Tutor] Difficulty Understanding Example Code for Blender Script

Andrew Martin amartin7211 at gmail.com
Thu Jul 22 06:48:22 CEST 2010


This code was part of a Blender script to build a 3d bar graph, so I don't
know if understanding Blender is a prereq for understanding this code. The
function is for the axis labels.

def label(text,position,orientation='z'):
    txt=Text3d.New('label')
    txt.setText(text)
    ob=Scene.GetCurrent().objects.new(txt)
    ob.setLocation(*position)
    if orientation=='x':
        ob.setEuler(-pi/2.0,0,0)
    elif orientation=='z':
        ob.setEuler(0,0,pi/2.0)
    print 'label %s at %s along %s' %(text,position,orientation)

 I understand it for the most part except for the orientation part. I assume
orientation is for the 3d text object, but how is it determined whether it
is x or z? Please keep replies simple; I am a newcomer to programming (and
if this makes no sense at all, I would appreciate polite inquiries for more
info).

Using Blender 2.49b and Python 2.6

Thanks a bunch,
amartin7211
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100722/c79c4846/attachment.html>


More information about the Tutor mailing list