Post #3481: ![](https://blenderartists.org/user_avatar/blenderartists.org/kim_quyen/48/61154

📋 Metadata

🏷️ Tags

macro python-scripting beginner solved

  • Macro Editor
  • Python Scripting

💬 Content

Kim_Quyen:

for obj in bpy.context.scene.objects:
    if obj.name.startswith("Cube"):
        obj.select_set(True)

I have this code, I want to enter it into the Macros to use, how to enter the right syntax ?

Use list comprehensions. Here is the code for Command tab:

[obj.select_set(True) for obj in bpy.context.scene.objects if obj.name.startswith("Cube")]

❤️ 4 likes


🔗 View on Blender Artists