# Is there any way to replace an object?

Is there any way to replace some object with another object?

For example, I have a bunch of cubes randomly placed throughout my project I want to replace those cubes with spheres. How can I replace the objects?

As usual there is may ways to achieve this. One approach would be to use the Link Object Data function, which basically allows you to swap out the Mesh Data (i.e. what you have in Edit Mode) with a selected mesh. The shortcut is Ctrl + L. See it in action here:

Whichever method you choose, you might get issues in regards to scale. If your cubes have different scale values in the Transform Panel, the spheres will have those different scales as well. If you had applied the scale before, all final spheres will be equally sized.

Even more important is the scale of the sphere. If that is not applied, but the cubes are, the resulting spheres will have a different size than the 'original'. The reason for both behaviors is this: The final representation of an object is a combination of Object and Object Data. The object holds the location, rotation and scale values. The data holds the mesh vertex coordinates, face info, etc. But the mesh data stores this info always as if the scale was 1. The output for the user is however displayed as the combination of both at all times. So before the sphere gets displayed on the screen, Blender applies the transformation matrix onto each vertex, and shows you the final result.

Final note: With this method, all objects will share the same mesh data. If you manipulate one, all of them will update when you exit Edit Mode.

• Perfect and thanks. One more additional to it if the cube have a random shape (i.e. big small medium) will this work – atek Oct 16 '16 at 6:46
• @atek that's what I mean with the scale. If in the transform panel the scales of the various cubes are different, the scales of the spheres will be different. Otherwise not. – aliasguru Oct 16 '16 at 7:23

Yes there is! I developed a blender extension back in 2013 but it still works. I stopped developing it however because I don't have time, so it is possible that there are some little bugs.

I just tested it with Blender v2.79 and it still works

• Can you explain what benefits this has over the linking method. If I had multiple objects I could just select the material for the active one and press Ctrl L > link materials which is the same amount of steps as in your addon. – Leander May 31 '18 at 9:39
• @Leander, The advantage is obviously that you can do this via the toolbar and don't have to remember the hotkeys needed to do this. And it is more beginner friendly. You can also replace materials and it has a function to list all objects from the scene and jump to them on click. It combines multiple features in one single place. – Black May 31 '18 at 15:32
• I'm guessing it's simply not my thing. In case you didn't know about, you might be interested in bforartists which was mentioned in another question earlier. – Leander May 31 '18 at 15:44

Following is the way to use Python scripting to solve the problem.

import bpy

active_object = bpy.context.active_object

# Ignore the last element of the list (which is the active object)
selected_objects = bpy.context.selected_objects[:-1]

if not selected_objects:
raise ValueError("Only one object selected")

meshes_to_remove = set()

for item in selected_objects: