Tutorial Needed: Custom Mesh in Blender 2.54

Hello, I would like please some help.

I want you explain to me how can I create my custon mesh with Python scripting in Blender 2.54. I have tried to study all the available scripts but I can’t understand them.

I would like to make a custom plane mesh for instance (with 4 vertices):
(It’s important not to use any existing primitives, but make a raw mesh from scratch)

  1. How can make vertices/edges/faces?
  2. How can I add these data to an object?

Thanks for any responses.

check out this tut on snippets
http://blenderartists.org/forum/showthread.php?t=193908

show how to add objects ect…

now to define a new mesh’s data
depends there are 2 ways right now in 2.54

1 - Geometry looks at the “pipe script” to see hwo it is done
but more complicated to do but it works

2 - the other simpler way use
mesh.from_pydata(verts, [], faces)

first make a list of vertices like in 2.49

list_of_verticesbw3=[
[-w2,w2,w2], # vertex 0
[-w2,-w2,w2],
[0,-z1-tip1,0],

]

then a list of edges or faces

list_of_facesbw3=[
[0,1,2,3], # face 0
[4,5,6,7], # face 1

]

then you add theses lists to the mesh

Create the new mesh with the data from verts and faces

mesh = bpy.data.meshes.new(name)
mesh.from_pydata(verts, [], faces)
mesh.from_pydata(list_of_verticesbw3, [], list_of_facesbw3)

mesh.update()

Create a new Object.

ob_new = bpy.data.objects.new(name, mesh)
ob_new.data = mesh
bpy.context.scene.objects.link(ob_new)

hope it helps
happy 2.5

Thank you for the explanation and the reference to the PDF file, they helped me a lot.