# Modeling with Python

I am new with Python programming, especially in Blender. I would like to know the possibilities of modeling with some scripts. I am currently modeling an object around a scan. I have to scan an object (with the Isense scanner), then modelize something aroung this object with blender.

I have more than 100 models to make and the base is always the same:

1. Create a point field that will stick the scanne (nearly always a kind of tube but the size differs sometimes)
2. Create a alveolar structure on this model (Voronoi diagram)

Do you know how I could do this ?

• I just edited your answer, but I was not sure what you meant by "on base of a scanne." I also don't know what you mean by "scanne"...perhaps "scan"? Please edit your answer to explain. – JakeD Nov 26 '16 at 13:34
• Scanne = scanner? – 10 Replies Nov 27 '16 at 0:49
• Yes sorry, scanne = scan (I use the scanner Isense to scan some objects) – Florian De Boeck Nov 27 '16 at 20:37

For your first step you don't need to use python, create a base and save it, then you can use that file as a starting point for each new object you create.

The simplest way to create a mesh object using python would be to define a list of vertices and faces that make up the mesh.

import bpy

verts = [(-1,  1,   0),
( 1,  1,   0),
( 2, -3,   0),
(-2, -1,   0),
(-1,  1.5, 1),
( 1,  1.5, 1),
]

# faces are a list of indices to each vertex from the above list
faces = [[0, 1, 2, 3], [0, 1, 5, 4]]

mesh = bpy.data.meshes.new(name="New Mesh")
mesh.from_pydata(verts, [], faces)
obj = bpy.data.objects.new('New object', mesh)