0
$\begingroup$

Is there a way to copy/duplicate/link objects to multiple locations at once? For instance I have several boxes around the scene and I want to copy/link/duplicate a sphere to the location of each box... Is this even possible?

$\endgroup$
  • $\begingroup$ have you tried linked duplications or instance groups? $\endgroup$ – moonboots Oct 5 '18 at 7:13
  • $\begingroup$ Create a plane with vertices at each location you want the object to appear then use Duliverts. You can delete the plane afterwards. Otherwise I think the only solution is Python scripting. $\endgroup$ – rob Oct 5 '18 at 7:29
2
$\begingroup$

I love Python scripting, however this can easily be done without Python. Here is one quick way:

  1. Select all the objects you want to use for position.
  2. Duplicate them.
  3. Add your the object you wish to duplicate in their position to the selection. It should be active now.
  4. Link their data ctrl+l -> Object Data

That is it. The object will inherit the position, orientation and scale. You could apply those in order to avoid that this if not needed (ctrl+a) before linking data.

enter image description here

| improve this answer | |
$\endgroup$
  • $\begingroup$ Cool! The only difficulty could, perhaps, be in selecting all the objects initially, if they are distributed widely or overlapping (... is it nitpicking? :) The drawback of python method is: it has to make selection based on some criteria, which would be necessarily arbitrary (like poly count in the python script) and break under some conditions. $\endgroup$ – Blender Dadaist Oct 6 '18 at 14:52
  • $\begingroup$ Well.. I would assume a selection method should be already thought trough while placing them. Maybe they are grouped, or share same material or any other trait in shift+g and shift+l menus. Another thing is - their origin point loaction in relation with their meshes should match. If they have transforms applied, that will not work obviously. $\endgroup$ – Martynas Žiemys Oct 6 '18 at 16:42
0
$\begingroup$

This can be done with a relatively straight forward script.

If you don't mind a script based solution, you can select the two objects (the one to be duplicated last) and execute the following script. Here the objects are considered of the same type based on the polygon count.

import bpy

if(len(bpy.context.selected_objects) != 2):
    print('Select exactly two objects, first: the object of the type whose location is to be copied and second: the object to be duplicated')

else:
    destObj = bpy.context.active_object
    srcObj = [o for o in bpy.context.selected_objects if o.name != destObj.name][0]

    srcObj.select = False

    srcPolyLen = len(srcObj.data.polygons)
    for i, obj in enumerate(bpy.data.objects):
        if(len(obj.data.polygons) == srcPolyLen):
            bpy.ops.object.duplicate_move(OBJECT_OT_duplicate={"linked":False, "mode":'TRANSLATION'}, TRANSFORM_OT_translate={"value":(-0, 0, 0), "constraint_axis":(False, False, False)})            
            bpy.context.object.location = obj.location
            bpy.context.object.select = False
            bpy.context.scene.objects.active = destObj
            destObj.select = True
    srcObj.select = True

duplicate objects

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.