Mesh creation in Python with 2.25
Moderators: jesterKing, stiv
Mesh creation in Python with 2.25
I'm trying to get started creating meshes in Blender 2.25 using Python. I have been successful creating NMeshes - but that seems to be deprocated.
The example script for the Mesh module in the 2.25 python documentation dies trying to load the "tess" module as mandated by "../modules/utils/tesselation.py" as soon as i get to the m.update() method.
Any suggestions ?
The example script for the Mesh module in the 2.25 python documentation dies trying to load the "tess" module as mandated by "../modules/utils/tesselation.py" as soon as i get to the m.update() method.
Any suggestions ?
Re: Mesh creation in Python with 2.25
Are you using linux version?daddy wrote:I'm trying to get started creating meshes in Blender 2.25 using Python. I have been successful creating NMeshes - but that seems to be deprocated.
The example script for the Mesh module in the 2.25 python documentation dies trying to load the "tess" module as mandated by "../modules/utils/tesselation.py" as soon as i get to the m.update() method.
Any suggestions ?
There was a problem with this function under win32 systems.
Zoo-3D.Blender, Ze French-Speaking Community SKB My french book about Blender.
No - still not working.
Here are its dying words...
Traceback (most recent call last):
File "mesh.py", line 32, in ?
m.update() # update and triangulate mesh
File "../modules/Blender/Mesh.py", line 203, in update
File "../modules/Blender/Mesh.py", line 69, in toTriangles
File "../modules/utils/tesselation.py", line 11, in ?
ImportError: No module named tess
If I need to set some kind of path, how would I do it ?
Here are its dying words...
Traceback (most recent call last):
File "mesh.py", line 32, in ?
m.update() # update and triangulate mesh
File "../modules/Blender/Mesh.py", line 203, in update
File "../modules/Blender/Mesh.py", line 69, in toTriangles
File "../modules/utils/tesselation.py", line 11, in ?
ImportError: No module named tess
If I need to set some kind of path, how would I do it ?
I did succeed in creating a series of vertexes (I haven't tried making faces yet, at least not that kind) I used the code in S68's post "Add material with 2.25API" posted at 6:08 on Tue November 19th in the Python part of the Elysiun forum.
Maybe he has some special magic - he (or she) does not see fit to call update() at all.
Maybe he has some special magic - he (or she) does not see fit to call update() at all.
as far as I understood it, the update() method should only be called when creating ngons.daddy wrote:Maybe he has some special magic - he (or she) does not see fit to call update() at all.
here's a little example that creates a plane, inspired by the docstring of the Mesh module (always read the docstrings, they are your best friends)
Code: Select all
import Blender
vlist = []
mesh = Blender.Mesh.New()
vlist.append(mesh.addVert((1.0,1.0,1.0)))
vlist.append(mesh.addVert((-1.0,1.0,1.0)))
vlist.append(mesh.addVert((-1.0,-1.0,-1.0)))
vlist.append(mesh.addVert((1.0,-1.0,-1.0)))
mesh.addFace(vlist)
ob = Blender.Object.New("Mesh")
ob.link(mesh)
Blender.Scene.getCurrent().link(ob)
Martin
Life is what happens to you when you're busy making other plans.
- John Lennon
- John Lennon
you have to use a different list for each face (at list, that's how I understood it)
like this:
Martin
like this:
Code: Select all
import Blender
face1 = []
mesh = Blender.Mesh.New()
face1.append(mesh.addVert((1.0,1.0,1.0)))
face1.append(mesh.addVert((-1.0,1.0,1.0)))
face1.append(mesh.addVert((-1.0,-1.0,-1.0)))
face1.append(mesh.addVert((1.0,-1.0,-1.0)))
mesh.addFace(face1)
face2 = []
face2.append(face1[0])
face2.append(face1[1])
face2.append(mesh.addVert((-1.0,2.0,1.0)))
face2.append(mesh.addVert((1.0,2.0,1.0)))
mesh.addFace(face2)
ob = Blender.Object.New("Mesh")
ob.link(mesh)
Blender.Scene.getCurrent().link(ob)
Martin
Life is what happens to you when you're busy making other plans.
- John Lennon
- John Lennon