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 ?

  • $\begingroup$ 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. $\endgroup$
    – JakeD
    Nov 26 '16 at 13:34
  • $\begingroup$ Scanne = scanner? $\endgroup$
    – 10 Replies
    Nov 27 '16 at 0:49
  • $\begingroup$ Yes sorry, scanne = scan (I use the scanner Isense to scan some objects) $\endgroup$ 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)

You might want to get familiar with the bmesh module which is used to perform most of the modelling tasks we do on mesh objects. The linked page contains an example of creating and editing a mesh.

As you don't know python very well yet I would suggest first trying out the sverchok addon. It uses nodes to generate mesh objects. The links on sverchoks home page are getting old so you may want to start with this playlist to get an idea of what you can do.

  • $\begingroup$ Thanks a lot for your answer!! Im gonna try what you said :-) True, I m realky new with Python so I have to improve my basic skills first Just, for the first answer, I use the same base for every models but I though that it was possible to attache and fix this base on the new scan. Hard to explain with words: - I open the scan in Blender - I open the base/model - I attache them together - and then I create the Voronoi structure on it $\endgroup$ Nov 27 '16 at 20:51
  • $\begingroup$ It sounds like creating a mesh object with python might not be what you want. You can use File->Append to copy an object from another blend file into the new scan file and use a boolean modifier to join them into one solid mesh, this could be automated with a python script. $\endgroup$
    – sambler
    Nov 27 '16 at 21:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.