GetSelected Help

Does anybody know how I would get something like this to work:

select=Object.GetSelected()[0]
obj=NMesh.GetRaw(select)

I get the error “expected string block found” so my main problem is getting the name of the selected object to be returned as a string.
Hopefully there’s a way to do this.

Adam

Try this:

obj=NMesh.GetRaw(select.name)

or better yet:


obj=Blender.Object.GetSelected()[0].data

Martin

or :


select=Blender.Object.GetSelected()
if len(select)>0:
   #better if a test controls that the data are meshes
   obj=Blender.NMesh.GetRaw(select[0].data.name)

jm

or, even better



meshlist = [ob.data for ob in Blender.Object.GetSelected() if ob and ob.data.Block_Type = "NMesh"]


:wink:

Martin

:-? … :o

That looks like fun. Maybe it’s time to actually learn Python.

(including my post above, I have written about 12 lines of Python code :wink: )

Pretty!
:slight_smile:

/me likes list comprehension 8)

Martin

Thanks Everyone! :smiley: