Naming and Organizing Objects

A scene is only as good as its names. Blender gives every new object a default name, and those defaults are how you end up with Cube.017 and an Outliner nobody can read. Fixing names by hand is tedious. Doing it in a script is two lines.

There is a second reason names matter: your own code uses them. bpy.data.objects["BRK_04"] finds one specific object, which is how a later script can move, export or measure exactly the part you meant.

One rule, applied by the loop

The trick is to let the loop supply the number. "Bracket_%02d" % (i + 1) gives you Bracket_01, Bracket_02 and so on, always two digits, so the list sorts correctly even when you have more than nine parts.

naming_demo.py

# Names are how you (and your scripts) find things later
import bpy

for obj in list(bpy.data.objects):
    bpy.data.objects.remove(obj, do_unlink=True)

# build a row of brackets with a naming rule
for i in range(6):
    bpy.ops.mesh.primitive_cube_add(size=0.2, location=(i * 0.5, 0, 0.1))
    part = bpy.context.object
    part.name = "Bracket_%02d" % (i + 1)

# rename in bulk: same loop, different rule
for obj in bpy.data.objects:
    if obj.name.startswith("Bracket"):
        obj.name = obj.name.replace("Bracket", "BRK")

# find one object by name, when you need it
print("Found:", bpy.data.objects["BRK_04"].name)
print("All:", [o.name for o in bpy.data.objects])
Six brackets created and renamed by the script
Six brackets, created and renamed by two small loops.
Text Editor close-up of the naming script
The script up close: create with one naming rule, rename with another.

Bulk renaming is a real job

Imported models are the classic case. You get forty objects called mesh_part_001 and you need them to match a client’s part numbers. By hand that is an afternoon and a few mistakes. In the script it is the same loop with a different rule, and you can run it again after every revision.

Outliner close-up of the renamed brackets
The Outliner up close: BRK_01 to BRK_06, numbered, predictable, sortable.
Viewport render with six named brackets
Same geometry, six clear names. Fifty of them would be just as easy.

A naming habit worth keeping

  • A prefix that says what the object is: BRK_, BOLT_, PANEL_.
  • A number with fixed width: 01, 02, 03.
  • A suffix for variants when needed: _L, _R, _v2.
  • Never rely on Blender’s automatic .001 endings in a file you will hand over.

Next: where objects actually sit. Coordinates, axes and orientation, the part everyone thinks they know until a part ends up on the floor.

← Back to the lessons list