Problem with Blender module


(stefu) #1

Hi!
I have problem using python Blender module. I have Blender version 223 and Python 2.0 (I tried 2.2 too).

The problem is that if I use Blender.isMesh(object.name) I get AttributeError: isMesh.
Also for example mesh.normals gives AttributeError, but mesh.verts works.
(mesh = NMesh.GetRaw(meshname))
And yes, I imported Blender. If I import Blender210 then I can use Blender210.isMesh but still mesh.nornals doesn’t work.

What the problem might be here?

Thanks.


(theeth) #2

isMesh is a Blende210 feature. If you use Blender, use the BlockType property to determine if it’S a mesh or not.

To get the normals, try this:



import Blender

mesh = Blender.NMesh.GetRaw(meshname)

vertlist = mesh.verts

for vert in vertlist:
        print vert.co # coordinate of the vertex
        print vert.no # normal of the vertex

Martin


(stefu) #3

Ok, that helped much :slight_smile:

So is this how to test object type?


if object.data.block_type=="NMesh":
    exportMesh(object)


(theeth) #4

exactly.

Martin