how to select object by BPy 2.5

:o

how to select object by BPy 2.5

thank

seems you have to iterate for now

for ob in bpy.data.objects:
if ob.name == “Cube”:

hope we get a better way soon !

happy blendering

thank rickyBlender

sorry for my english

my case for

in scene have have object cube , cube.001, cube.002

how call object by use script

in you link in other post

i try to see something for

OBJECT_OT_select_by_name or OBJECT_OT_select_name but unlucky for call name object to select for do other ops

2.5 will dev and i will wait for

thank agin :slight_smile:

sorry for my english

:othank rickBlender

sorry for my english

my case

in scene have object Cube, Cube.001 ,Cube.002

i want to ops call name for select it by script

i didn’t see it in ops and rna

2.5 in dev i will wait for office relese

thank again

and sorry for my english again

:o

You don’t have to iterate over the objects, you can index the objects by name:


ob = bpy.data.objects['Cube']

You can then do anything you want with that object. However, you can not make the object selected in the View3d if that is what you want, because ob.selected is a read only attribute.

:yes:

thank you

varkenvarken

:smiley:

That’s a really odd thing isn’t it? wwith the new move to “operators” being able to select stuff through script and then operate on it would be a pretty basic “macro” function…(you would think)

There’s stiill lots of stuff in the interface that isn’t an operator… (or at least doesn’t get “echoed” in the console…) eg clicking on the “mode” selectors in edit mode (edge, face, vertex) for example…

I’m still hoping for things like “puplist” to return too…

They’ll probably add a way to select objects (I agree with Michael; it’s nearly the most basic thing you can think of), but for now you could use a workaround:

  • Move the object to an empty layer. (doc)
  • Select all the items on that layer. (doc)
  • Move the object back to its original layer.

Though it might be better to wait for a proper implementation.

:yes:

wow

Crouch

thank you

:smiley: