How can I skip non mesh objects?

:o How would I skip all non mesh/empty objects in the selected list. Currently, when I try to access the .data of a curve/surface - Blender pops up with a pyhton pops up with a missing module error.

Anyone got any ideas?

import Blender
MeshList = [ob for ob in Blender.Object.GetSelected() if ob and and == "NMesh"]

I’m not sure about the Block_Type property though, you’ll have to check for the correct spelling.

this creates a list of all the selected Mesh objects.


Thanks for the help, but thats something close to that is what i already have - the problem is;

when you try to access the .data part of a curve/surface then python pops up a error message of a missing module. So the poblem with the above snippet is, that it will halt and not ship non mesh objects. :frowning:

Python error is…

File “…/modules/Blender/”, line 156, in getattr
File “…/modules/Blender/”, line 97, in _getattrEx
SystemError: unable to create Block for data

Is there any way to work around this missing module?

what Blender version are you using?

I’m pretty sure it works with 2.23, since the “if” part takes care of the object where data is inextistant.

if not, you could use this:

import Blender

ObList = Blender.Object.Get()
MeshList = []
for Ob in ObList:
                if Ob and and == "NMesh":


Blender version is publisher (2.25) as in from the downloads on . Just off to test a few bits, will report back soon.

Woot!!, the 2nd snippet does the trick :slight_smile: - or at least points me in the right direction! :smiley:

Thanks again

Although works in Publisher, the advised method from the docs is to use ob.getData(). When using dir(), the results are different too.

I forgot, to get the type of the object, use ob.getType(), this will return ‘Mesh’ for a mesh, for anything else that is not supported it will return ‘<unsupported>’