Modifying vertexes?

I’m trying to teach myself a little Python and Blender.

I want to read in data from an external file and use it to create a plane, resize it, subdivide it and then set the vertices at varying z locations to create 3d sin waves. Eventually, I will try to read in multiple sets of z data and create keyframes and hopefully make and animation from the data I read in. The point of the exercise is not the specific data, but to learn to read in data and use it to create models and animations.

I found some code that let me address the vertices for a particular object that was made in Blender.

#
for item in bpy.data.objects
        if item.name =="Plane5":
            for vertex in item.data.vertices:
                vertex.co[2] = 0
#

That worked fine and I used it to figure out what my formula for modifying the z values would be. I went and substituted my mathmatical result for the 0 in the last line.

So then I wrote out a Python program in Idle that gave me the x, y, and z data and let me choose how many cuts to put into the plane and generated the data.

Now I am trying to create code that reads in the data, creates the plane, sizes it, makes the right number of cuts and then drops in the z data at each vertex.

I got creating the object, resizing it, and subdividing it no problem. But I’m not getting anywhere being able to access the data for the vertices.

I did the creation of the object, sizing and subdividing by doing the steps, copying the readouts from the info window and modifying the code, so all the information was based on bpy.ops.mesh, bpy.ops.object, bpy.ops.transform and I can identify the active object with the bpy.context.object.

But I don’t seem to be able to access the vertices via these. I’ve looked at the API docs but just got confused.

Any ideas on how I address the vertices?

Thanks.

??? but you did the vertices as far as I can see correctly???

By the way tell (us) your blender version (to be found blender.exe -v ) …

Have you tried directly accessing the created meshes through:

bpy.meshes[<i>0</i>].vertices[<i>0</i>].co[2]

?

see HIS code, he did!

BUT as I asked: which Blender-version?! I am on version 2.63!!