3

I'm going to select multiple objects in blender with script the name would be [cube101, cube102, cube103, cube104, cube105......] is there anyway to simplify the long script with [cube10*] to tell blender the objects I want are "something + *" ?

  • 2
    python list comprehension is prob your best bet [o for o in bpy.data.objects if o.name.startswith("cube10")] Change the collection to bpy.context.scene.objects for only objects in the context scene etc. Related http://blender.stackexchange.com/questions/6136/how-can-i-get-a-list-of-all-objects-named-foo?rq=1 .... quite likely the q will be marked as duplicate. – batFINGER Sep 10 '16 at 07:56
  • o for o in bpy.data.objects if o.name.startswith("1") ^ SyntaxError: invalid syntax

    /why did I get wrong in console? syntax error?

    – Francis Wei Ming-Wei Sep 11 '16 at 15:58
  • list coprehension, needs to be in [...] or (...) The latter being a generator. – batFINGER Sep 11 '16 at 16:01

0 Answers0